Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8492415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:42:45+00:00 2026-06-10T22:42:45+00:00

I am unable to compare two non-ascii strings, although both the strings appear the

  • 0

I am unable to compare two non-ascii strings, although both the strings appear the same on the console. Below is what I tried. Please let me know what code is missing here, so that the two variables shall be equal.

if($lineContent[7] ne $name) {
  /*Control coming to here*/
  print "###### Values MIS-MATCHED\n";
} else {
  print "###### Values MATCHED\n";
}

$lineContent[7] is from a CSV file

$name is from an XML file

When Putty’s console is in the default Characterset

CSV Val: ENB69-åºå°å±
XML Val: ENB69-åºå°å±

When Putty’s Console is set to UTF-8

CSV Val: ENB69-基地局
XML Val: ENB69-基地局
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:42:47+00:00Added an answer on June 10, 2026 at 10:42 pm

    Your inputs:

    "ENB13-\345\237\272\345\234\260\345\261\200"
    "ENB13-\x{57fa}\x{5730}\x{5c40}"
    

    As you can see, these are clearly not the same. Specifically, the first is the UTF-8 encoding of the other. Always decode inputs. Always encode outputs.

    use strict;
    use warnings;
    
    use utf8;                             # Source code is saved as UTF-8
    use open ':std', ':encoding(UTF-8)';  # Terminal expects UTF-8
    
    my $name = "ENB69-基地局";
    
    while ($line = <STDIN>) {
       chomp;
       my @lineContent = split /\t/, $line;
       print($lineContent[7] eq $name ?1:0, "\n");  # 1
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I need to do is compare two strings and mark the differences with
I am unable to convert strings to date with throwing exceptions of not proper
I have a Java program running on two computers that are both on the
I am unable to print/compare the letters æøå with the uppercase letters ÆØÅ. My
All, I currently have two projects that are under SourceSafe that I am unable
I want to compare two array indices, for (int i=0; i<[CustomeDateArray count]; i++) {
the code below is unable to find a matching record when it should: $result
I am trying to overload == operator to compare objects like below. class A
I am unable to do an IF comparison of objects. When I compare them
Unable to cast object type System.Collections.Generic.List 1[NorthwindMVC3.Models.Product] to the type ofSystem.Collections.Generic.IEnumerator 1[NorthwindMVC3.Models.Product].\ public IEnumerator<Product>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.