STINNER Victor <vstin...@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 <rep...@bugs.python.org> <https://bugs.python.org/issue26024> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com