What is a good way to compare two individual characters (either char
or UTF-16 wchar_t
s) ignoring case?
A trivial implementation would be upper- or lowercasing both. Is one of these considered better, or are there other methods?
I understand that a completely correct comparison is not possible with all details of Unicode. The comparison is meant mostly for some basic parsing of config files and micro grammars, so perfection isn't required. I am looking for a not-too-wrong implementation under the restriction of per-character comparison.
[edit]
These configuration files may contain text displayed to the user. Also, when analyzing user input, I can't avoid unicode text.