3 ms·
Compared this vs another comment and its interesting. Pulled the strings directly from the ISO website. I wonder if the 'i' in the lower case one is supposed to
by Bedon292 4y ago
Compared this vs another comment and its interesting. Pulled the strings directly from the ISO website. I wonder if the 'i' in the lower case one is supposed to be special and not ASCII?
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> short_name_lower = "Türkiye"
>>> short_name = "TÜRKİYE"
>>> short_name.encode() ## The Ü and İ are UTF-8 chars
b'T\xc3\x9cRK\xc4\xb0YE'
>>> short_name_lower.encode() ## Note only the ü is special, i is just ASCII
b'T\xc3\xbcrkiye'
>>> short_name.lower()
'türki̇ye'
>>> short_name_lower.lower()
'türkiye'
>>> short_name.lower() == short_name_lower.lower() ## Looks the same, but it isn't
False
>>> short_name.lower().encode() ## The i has extra \xcc\x87 here
b't\xc3\xbcrki\xcc\x87ye'
>>> short_name_lower.lower().encode() ## The i doesn't have the extra here
b't\xc3\xbcrkiye'
>>> short_name_lower.upper().encode() ## So this is wrong too, since its just an ASCII i to start
b'T\xc3\x9cRKIYE'
Edit: Formatting
- neuronexmachina 4y agoIt's apparently a locale-specific capitalization rule: https://www.gamedeveloper.com/business/problematic-case-conversion-in-turkish https://www.gamedeveloper.com/business/problematic-case-conv... > In Turkish, the character “i” becomes “İ” when capitalized, while the “ı” (a Turkish-specific character) becomes “I” (which looks just like the Latin upper case “I”). > The out-of-the-box capitalization method implemented by developers or by localization tools by default is often the standard ‘toUpper()’, which doesn’t follow language-specific rules and will convert the “i” into an “I”. As for the lower case “ı”, it will simply fail to capitalize it at all. This will result in a very strange looking text in the game with uncapitalized characters and wrongly capitalized ones.