3 ms·
Well I just tried in the browser console and got: 'ß'.toUpperCase() // = "SS" 'ß'.toLowerCase() // = "ß"
by gitgud 7y ago
Well I just tried in the browser console and got:
'ß'.toUpperCase() // = "SS"
'ß'.toLowerCase() // = "ß"
- dathinab 7y agoNote that Unicode did add a "uppercase-ish" ß, as it does appear in German, but only in context of an all caps word e.g on a sign board, so captilazation of a whole word to SS and that new all caps ß are both correct (not sure if UNICODE changed the capitalization rules or just added that strange all caps ß)
- thristian 7y agoFor backwards compatibility reasons, the capitalization rules can't be changed for existing characters. So normalizing by naive case-folding now requires at least three steps: "ẞ".to_lower() → "ß" "ß".to_upper() → "SS" "SS".to_lower() → "ss" (there's a standard for how to compare strings case-insensitively that doesn't involve repeated case-folding, but it's much more complex)
- jrochkind1 7y agoWow, I did not know about this weird edge case, interesting, thanks!
- Pahr3yah 7y agoUnicode has a dedicated case folding[0][1] (as opposed to upper/lower case mapping) algorithm to cover these cases. [0] https://www.unicode.org/reports/tr21/tr21-3.html#Caseless%20Matching https://www.unicode.org/reports/tr21/tr21-3.html#Caseless%20... [1] http://userguide.icu-project.org/transforms/casemappings#TOC-Case-Folding http://userguide.icu-project.org/transforms/casemappings#TOC...