[issue47000] Make encoding="locale" uses locale encoding even in UTF-8 mode is enabled.

STINNER Victor report at bugs.python.org
Wed Mar 23 08:15:58 EDT 2022


STINNER Victor <vstinner at python.org> added the comment:

sys.getlocaleencoding() versus locale.getencoding().

For me, the Python locale module should use the C API to access the Unix locales like LC_CTYPE, nl_langinfo(CODESET), etc.

The sys module are more for things specific to Python, like sys.getfilesystemencoding().

Since sys.getlocaleencoding() would be a fixed value for the whole process life time, I agree that the sys module is a better place.

I can write a PR adding sys.getlocaleencoding() if we agree on the API.

----------

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


More information about the Python-bugs-list mailing list