The comparison result of Unicode strings looks strange... #51726
-
But...
Why is that? This is a bug or WAD? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The default overload of string.Compare uses current culture. Under Chinese culture, the comparison is based on Pinyin, thus yi > er. |
Beta Was this translation helpful? Give feedback.
-
I can't speak to what the comparison result should be, other than to note that sorting solely on unicode codepoint is probably not correct, since there are multiple languages that use Latin characters plus some additions (say, Turkish). Unicode doesn't redefine the Latin characters, and if a specific order is to be retained you need some custom sort table. |
Beta Was this translation helpful? Give feedback.
The default overload of string.Compare uses current culture. Under Chinese culture, the comparison is based on Pinyin, thus yi > er.