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 vidartf
Recipients ezio.melotti, paul.moore, steve.dower, tim.golden, vidartf, vstinner, zach.ware
Date 2016-01-06.14:28:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452090490.23.0.240691672935.issue26024@psf.upfronthosting.co.za>
In-reply-to
Content
The Norwegian locale on Windows has the honor of having the only locale name with a non-ASCII character ('Norwegian Bokmål_Norway', see e.g. https://wiki.postgresql.org/wiki/Changes_To_Norwegian_Locale). It does not seem like python 3 is able to handle this properly, as the following code demonstrates:

>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_TIME, 'swedish')
'Swedish_Sweden.1252'
>>> loc_sw = locale.getlocale(locale.LC_TIME)
>>> locale.setlocale(locale.LC_TIME, 'norwegian')
'Norwegian Bokmål_Norway.1252'
>>> loc_no = locale.getlocale(locale.LC_TIME)
>>> locale.setlocale(locale.LC_TIME, loc_sw)
'Swedish_Sweden.1252'
>>> locale.setlocale(locale.LC_TIME, loc_no)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\prog\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\locale.py", line 593, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting


As can be seen, this can be worked around when setting the locale manually, but if the locale has already been set to Norwegian, the value returned from getlocale is invalid when passed to setlocale.

Following the example of postgres in the link above, I suggest changing the behavior of locale.getlocale to alias 'Norwegian Bokmål_Norway.1252' as 'Norwegian_Norway.1252', which is completely ASCII, and therefore fine.
History
Date User Action Args
2016-01-06 14:28:10vidartfsetrecipients: + vidartf, paul.moore, vstinner, tim.golden, ezio.melotti, zach.ware, steve.dower
2016-01-06 14:28:10vidartfsetmessageid: <1452090490.23.0.240691672935.issue26024@psf.upfronthosting.co.za>
2016-01-06 14:28:10vidartflinkissue26024 messages
2016-01-06 14:28:09vidartfcreate