3 ms·
For backwards compatibility reasons, the capitalization rules can't be changed for existing characters. So normalizing by naive case-folding now requires at lea
by thristian 7y ago
For 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...