[issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

Eryk Sun report at bugs.python.org
Fri Mar 19 21:37:15 EDT 2021


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

> But please discuss it in another issue.

What's returned by locale.get_locale_encoding() and locale.get_current_locale_encoding() is relevant to adding them as new functions and is a chance to implement this correctly in Windows. 

You're right that what open() does for encoding="locale" is a separate issue, with backwards compatibility problems. I think it was implemented badly and needlessly inconsistent with POSIX. But we may be stuck with the behavior considering scripts are within their rights, per documented behavior, to expect that calling setlocale(LC_CTYPE, locale_name) in Windows has no effect on the result of locale.getpreferredencoding(False), unlike POSIX generally, except for some platforms such as macOS and Android.

----------

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


More information about the Python-bugs-list mailing list