You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
string method .upper() converts 'ß' to 'SS' instead of 'ẞ' #79109
There's a special letter in German orthography called "eszett" (ß). This letter had no uppercase variant for hundreds of years until 2017, there was an uppercase variant added to the official German orthography called "capital eszett" (ẞ) 1.
Python's .upper() string method still translates this to "SS" (which was correct before 2017):
~ $ python3.7.0
Python 3.7.0 (default, Aug 29 2018, 17:15:17)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 'gruß'.upper()
'GRUSS'
>>>
The result of this example should have been 'GRUẞ' instead.
That being said, it's fair to inform about the fact that this letter is still quite unpopular in Germany; it is not even typeable with German keyboards, yet. Anyways, I think since this became officials orthography, it's not Python's job to adopt behaviors but clear rules instead.
I'm not sure if this affects .casefold() as well, since I do not get that method's scope.
We match the Unicode specification, not arbitrary language rules. (Austrian and Swiss German are, I believe, phasing out ß altogether, and haven't added an uppercase variant.)
Until the Unicode consortium change their case conversion rules, it is still correct for .upper() to convert 'ß' to 'SS'. The eszett is just one of the many annoying anomalies in case conversion, like Turkish dotted and dotless i. Natural language is hard, and messy.
Activity
MarcRichter commentedon Oct 8, 2018
There's a special letter in German orthography called "eszett" (ß). This letter had no uppercase variant for hundreds of years until 2017, there was an uppercase variant added to the official German orthography called "capital eszett" (ẞ) 1.
Python's .upper() string method still translates this to "SS" (which was correct before 2017):
~ $ python3.7.0 Python 3.7.0 (default, Aug 29 2018, 17:15:17) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 'gruß'.upper() 'GRUSS' >>>The result of this example should have been 'GRUẞ' instead.
That being said, it's fair to inform about the fact that this letter is still quite unpopular in Germany; it is not even typeable with German keyboards, yet. Anyways, I think since this became officials orthography, it's not Python's job to adopt behaviors but clear rules instead.
I'm not sure if this affects .casefold() as well, since I do not get that method's scope.
BR,
Marc Richter
stevendaprano commentedon Oct 8, 2018
We match the Unicode specification, not arbitrary language rules. (Austrian and Swiss German are, I believe, phasing out ß altogether, and haven't added an uppercase variant.)
Until the Unicode consortium change their case conversion rules, it is still correct for .upper() to convert 'ß' to 'SS'. The eszett is just one of the many annoying anomalies in case conversion, like Turkish dotted and dotless i. Natural language is hard, and messy.
http://unicode.org/faq/casemap_charprop.html
tirkarthi commentedon Oct 8, 2018
Thanks for the report and details but I think this exact case was already discussed in bpo-30810.
MarcRichter commentedon Oct 8, 2018
Sorry then; that did not show up in my search :/
Yes, seems like this is duplicating that one.
tirkarthi commentedon Oct 8, 2018
No problem. Thanks for the confirmation I am closing this as a duplicate.