Author lemburg
Recipients cstratak, lemburg, serhiy.storchaka, skrah, vstinner
Date 2018-01-15.13:13:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516022024.46.0.467229070634.issue31900@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, it seems that the C setlocale() itself does not follow the conventions set forth for environment variables:

http://pubs.opengroup.org/onlinepubs/7908799/xsh/setlocale.html

(see the example at the bottom)

So the behavior shown by Python's setlocale() is fine.

However, that still doesn't magically make this work:

locale.setlocale(locale.LC_ALL, 'C.UTF-8')
locale.setlocale(locale.LC_NUMERIC, 'fr_FR.ISO8859-1')

If LC_NUMERIC uses a different encoding than LC_ALL, there's really no surprise in having numeric formatting fail. localeconv() will output the set encoding for the numeric string conversion and Python will decode this using the locale encoding set by LC_ALL. If those two are different, you run into problems.

I would not consider this a bug in Python, but rather in the locale settings passed to setlocale().
History
Date User Action Args
2018-01-15 13:13:44lemburgsetrecipients: + lemburg, vstinner, skrah, serhiy.storchaka, cstratak
2018-01-15 13:13:44lemburgsetmessageid: <1516022024.46.0.467229070634.issue31900@psf.upfronthosting.co.za>
2018-01-15 13:13:44lemburglinkissue31900 messages
2018-01-15 13:13:44lemburgcreate