STINNER Victor <vstin...@python.org> added the comment:
> - If you add "current", people will rightly ask: then what do all the > other APIs in the locale module return ? Of course, they all return > the current state of settings :-) So this is unnecessary as well. The problem is that there are two different "locale encodings", what I call: * "current locale encoding": nl_langinfo(CODESET) in short * "Python locale encoding": "UTF-8" in some cases, nl_langinfo(CODESET) otherwise It is unfortunate that the Python UTF-8 Mode which "ignores the locale" changes the behavior of the locale module, of the locale.getpreferredencoding() function. But the ship has sailed. People are used to look into the "locale" module to get the "locale" encoding. So I prefer to put the function to get the "Python locale encoding" in the locale module. I propose to add "current" in the name since this encoding is not the one you are looking for usually. An alternative is to have a single function with an optional parameter. Example: * get_locale_encoding() or get_locale_encoding(True) returns the locale encoding * get_locale_encoding(False) returns the current locale encoding ---------- _______________________________________ 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