Here's part of the data from my SQL table:
When I fetch data show me like below
But when I use equal condition, it returns false
I check ASCII code and I am confused because it is different.
this.NameOfComm :
"doc" :
CodePudding user response:
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
D
O
C
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));