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.

作者 lemburg
收信人 cstratak, lemburg, serhiy.storchaka, skrah, vstinner
日期 2018-01-15.13:13:44
SpamBayes Score -1.0
Marked as misclassified
Message-id <1516022024.46.0.467229070634.issue31900@psf.upfronthosting.co.za>
In-reply-to
内容
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().
历史
日期 用户 动作 参数
2018-01-15 13:13:44lemburg修改recipients: + lemburg, vstinner, skrah, serhiy.storchaka, cstratak
2018-01-15 13:13:44lemburg修改messageid: <1516022024.46.0.467229070634.issue31900@psf.upfronthosting.co.za>
2018-01-15 13:13:44lemburg链接issue31900 messages
2018-01-15 13:13:44lemburg创建