This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients ezio.melotti, lemburg, methane, vstinner
Date 2022-03-23.02:48:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> * sys.getfilesystemencoding(): Python filesystem encoding, return "UTF-8" if the Python UTF-8 Mode is enabled


> * locale.getencoding(): Get the locale encoding, LC_CTYPE locale encoding or the Windows ANSI code page, *read at Python startup*. Ignore the Python UTF-8 Mode.

I proposed `locale.get_encoding()` in the PEP 686. I will remove underscore if you don't like it.

> * locale.getencoding(current=True): Get the *current* locale encoding. The difference with locale.getencoding() is that on Unix, it gets the LC_CTYPE locale encoding at each call.

Hmm, I don't add it to the PEP 686 because it is not relating to UTF-8 mode nor EncodingWarning.

Since `locale.getencoding()` returns locale encoding on startup, how about this idea?

* sys.getlocaleencoding() -- Get the locale encoding read at Python startup.
* locale.getencoding() -- Get the current locale encoding.

Note that we have `sys.getdefaultencoding()` and `sys.getfilesystemencoding()`. `sys.getlocaleencoding()` looks consistent with them.
Date User Action Args
2022-03-23 02:48:59methanesetrecipients: + methane, lemburg, vstinner, ezio.melotti
2022-03-23 02:48:59methanesetmessageid: <>
2022-03-23 02:48:59methanelinkissue47000 messages
2022-03-23 02:48:59methanecreate