3 ms·
.NET strings are backed by two-byte UTF-16 codepoints, not bytes in an unknown encoding. But ordinal comparison means ignoring equivalence classes, like U+006E
by jameshart 5y ago
.NET strings are backed by two-byte UTF-16 codepoints, not bytes in an unknown encoding.
But ordinal comparison means ignoring equivalence classes, like U+006E (n) + U+0303 (combining tilde) being considered the same as U+00F1 (ñ). But - perhaps more surprisingly - .net's non-ordinal match also matches things like "ß" and "ss".
That leads to some weird things like even if two strings compare as equal in the invariant culture, if you uppercase them in the invariant culture they may no longer be considered equal.
And that's all before you start looking at culture-variant behaviors like different cultures having different casing rules (see Turkish dotless i) or approaches to diacritic equivalence for sorting.