This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eryksun, ezio.melotti, paul.moore, serhiy.storchaka, steve.dower, tim.golden, vidartf, vstinner, zach.ware
Date 2019-08-23.13:49:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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") 
>>> locale.setlocale(locale.LC_ALL, "norwegian") 

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'.
Date User Action Args
2019-08-23 13:49:19vstinnersetrecipients: + vstinner, paul.moore, tim.golden, ezio.melotti, zach.ware, serhiy.storchaka, eryksun, steve.dower, vidartf
2019-08-23 13:49:18vstinnersetmessageid: <>
2019-08-23 13:49:18vstinnerlinkissue26024 messages
2019-08-23 13:49:18vstinnercreate