3 ms·
I can see how that could fail horribly when you have arbitrary Unicode data. For instance, the German sharp s (ß) has an asymmetrical casemapping. From the Un
by M2Ys4U 11y ago
I can see how that could fail horribly when you have arbitrary Unicode data.
For instance, the German sharp s (ß) has an asymmetrical casemapping.
From the Unicode standard[0]:
>The German sharp s character has several complications in case mapping. Not only does its uppercase mapping expand in length, but its default case-pairings are asymmetrical. The default case mapping operations follow standard German orthography, which uses the string “SS” as the regular uppercase mapping for U+00DF ß latin small letter sharp s. In contrast, the alternate, single character uppercase form, U+1E9E latin capital letter sharp s, is intended for typographical representations of signage and uppercase titles, and in other environments where users require the sharp s to be preserved in uppercase. Overall, such usage is uncommon. Thus, when using the default Unicode casing operations, capital sharp s will lowercase to small sharp s, but not vice versa: small sharp s uppercases to “SS”, as shown in Figure 5-16. A tailored casing operation is needed in circumstances requiring small sharp s to uppercase to capital sharp s.
[0] http://www.unicode.org/versions/Unicode7.0.0/ch05.pdf#G21180 http://www.unicode.org/versions/Unicode7.0.0/ch05.pdf#G21180
- pavel_lishin 11y agoWhy would that fail horribly?
- ars 11y ago> For instance, the German sharp s (ß) has an asymmetrical casemapping. As they say "so don't do that". This is about capslock, not lettercase in general. Only switch characters that change with capslock on the keyboard. And even if the mapping is not perfect - so what? The worst that will happen is nothing.