Why do I need it: I have a task to handle Windows file names, particularly use them as keys. Their keys should be unique when and only when the corresponding files can coexist at Windows filesystem. I could convert it to upper or lower case.
This page says that ToUpperInvariant()
should be used instead of ToLowerInvariant()
, because:
A small group of characters, when they are converted to lowercase, cannot make a round trip.
Then, this answer provides examples of "ϱ", "ς", "ß", which may have this issue.
So the risk would be one of those:
- there are 2 symbols
a1
anda2
, which would clash at filesystem. ButToLowerInvariant()
keeps them unchanged, and therefore different. - there are 2 symbols
A1
andA2
, which would convert byToLowerInvariant()
to same lowercase symbol. They do not clash at filesystem. - anything else I missed?
And it is then assumed that ToUpperInvariant()
should be somehow better than ToLowerInvariant()
, so then it would produce different result which is correct.
I have tried the symbols from the linked answer, and actually all listed are not touched by To(Lower/Upper)Invariant()
, even "ß" and "ẞ" are independent. I indeed can even create 2 files which differ only by those symbols, and they do not clash.
So, the question is: which are the actual examples when equivalence defined by ToLowerInvariant()
is wrong (does not match Windows filesystem)?