3

Here's part of the data from my SQL table:

SQL data

When I fetch data show me like below

c# show

But when I use equal condition, it returns false

enter image description here

I check ASCII code and I am confused because it is different.

this.NameOfComm :

enter image description here

"doc" :

enter image description here

2
  • d is U+FF44 is compart.com/en/unicode/U+FF44 - which is not ASCII D. Commented Jun 18, 2022 at 6:36
  • 2
    In your screenshot one is full width DOC and the other is half width DOC. Commented Jun 18, 2022 at 6:37

1 Answer 1

6

If you look very closely, you will note that, in your first screenshot, the DOC in the first line has a slightly different font than the one in the second line.

  • One of them contains the regular ASCII characters D O C , whereas
  • the other one contains the fullwidth forms from the Unicode block U+FF00–FFEF. These are special forms of the Latin characters used to align nicely with Chinese/Japanese/Korean characters.

(In addition, the fullwidth form characters seem to be HTML encoded, but that might be an artifact of your analysis.)


You can use string.Normalize to "fix" this:

// prints DOC
Console.WriteLine("DOC".Normalize(NormalizationForm.FormKC));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.