[issue26024] Non-ascii Windows locale names
STINNER Victor
report at bugs.python.org
Fri Aug 23 09:49:18 EDT 2019
STINNER Victor <vstinner at redhat.com> added the comment:
It seems like this bug has been fixed in Python 3.5, so I close the issue.
What changed in Python 3.5 is that the *result* of locale.setlocale() is now the english name of the locale and so is compatible with the ASCII encoding.
Vidar Fauske:
> The Norwegian locale on Windows has the honor of having the only locale name with a non-ASCII character
On which Windows version? On Windows 10 build 1903 with Python 3.9, it seems like locale names can be encoded/decoded from ASCII:
>>> locale.setlocale(locale.LC_ALL, "swedish")
'Swedish_Sweden.1252'
>>> locale.setlocale(locale.LC_ALL, "norwegian")
'Norwegian_Norway.1252'
Eryk Sun confirmed that Python 3.5 doesn't seem to be affected anymore:
> The issue isn't quite the same for 3.5+. The new CRT uses Windows Vista locale APIs. In this case it uses LOCALE_SENGLISHLANGUAGENAME instead of the old LOCALE_SENGLANGUAGE. This maps "Norwegian" to simply "Norwegian" instead of "Norwegian Bokmål":
---
If you consider there is still an issue with the second argument of locale.setlocale() which doesn't use the right encoding, please open a separated issue.
The workaround is to use the english name of locales. For example, use 'norwegian' or 'Norwegian_Norway.1252', instead of 'Norwegian Bokmål_Norway.1252'.
----------
resolution: third party -> fixed
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue26024>
_______________________________________
More information about the Python-bugs-list
mailing list