STINNER Victor <vstin...@python.org> added the comment:
> locale.getencoding() > > which interfaces to nl_langinfo(CODESET) or the Windows code > page and does not try to do any magic, ie. does *not* call > setlocale(). It needs to return what the lib C currently > knows and uses as encoding. This is locale.get_current_locale_encoding(). I would like to put "current" in the name, because there is a lot of confusion between get_current_locale_encoding() encoding and locale.getpreferredencoding(False) encoding. In locale.getpreferredencoding(False), Python ignores the locale in some cases which is counter intuitive. I propose to add new functions to reduce confusion and better document the subtle differences between the different "locale encodings". That's also why I propose to rename the "locale encoding" to the "Python locale encoding" in the documentation: clarify the Python ignores the locale sometimes. The PEP 538 (coerce the C locale) and PEP 540 (Python UTF-8 Mode) introduced confusion. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43552> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com