I am studying case insensitive handling in my application. So far, I realized that there are two different cases:
- data is visualized for the user
- data is processed internally
For case 1, you should always use the user locale. This means that, for example, when sorting items in a list and you want this to be case-insensitive, then you should use case-insensitive string comparison functions, taking into account the language.
In case 2, it seems logical that you do not want to use the user locale, since this can have undesirable consequences if you have users using a different language, but still using the same data set (for example, if you manage the library you can use the name of the book as the key for your copy of the book in the database and want to handle this case sensitivity (this is a simplification, I know)).
When using STL containers (for example, std :: map), I noticed that it is much more efficient to put the key in uppercase and then search in uppercase. This is more efficient than comparing case insensitivity when cycling on a map. For std :: unordered_map, you probably need to do such a trick.
However, I realized that this could have strange effects, and I wonder how Windows (also using case-insensitive names) handles these situations.
eg. The German Γ (ringel-S) is written as SS if you put it in uppercase. This seems to mean that Γ.txt and SS.txt should denote the same file, so Γs.txt and sΓ.txt and sss.txt and SSS.txt should also denote the same file. But in my experiments, this is not like Windows.
So my questions are:
- What C ++ and / or Windows functions should be used to execute case-insensitive language-independent strings?
- ++ / Windows (, ), std:: map ( , std:: unordered_map)?
- ( ) ( , )?