[issue20088] locale.getlocale() fails if locale name doesn't include encoding

Eryk Sun report at bugs.python.org
Thu Mar 4 10:21:05 EST 2021


Eryk Sun <eryksun at gmail.com> added the comment:

The locale_alias database was extended to support "en_AG" and many others, but I'd still prefer Serhiy's suggestion to not guess the codeset when checking the default LC_CTYPE category. Use locale.nl_langinfo(locale.CODESET), if it's available. 

In Windows, I'd prefer to never guess since the encoding for a BCP-47 locale name can be directly queried. But this issue can be restricted to POSIX. What to do in Windows is already being considered in more recent issues: bpo-23425, bpo-37945, and bpo-43115.

----------
components:  -Windows
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue20088>
_______________________________________


More information about the Python-bugs-list mailing list