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, methane, vstinner
Date 2022-03-13.06:09:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Currently, `encoding="locale"` is just shortcut of `encoding=locale.getpreferredencoding(False)`.

`encoding="locale"` means that "locale encoding should be used here, even if Python default encoding is changed to UTF-8".

I am not sure that UTF-8 mode becomes the default or not.
But some user want to use UTF-8 mode to change default encoding in their Python environments without waiting Python default encoding changed.

So I think `encoding="locale"` should use real locale encoding (ACP on Windows) regardless UTF-8 mode is enabled or not.

Currently, UTF-8 mode affects to `_Py_GetLocaleEncoding()`. So it is difficult that make encoding="locale" ignores UTF-8 mode.
Is it safe to use `locale.getlocale(locale.LC_CTYPE)[1] or "UTF-8"`?
Date User Action Args
2022-03-13 06:09:52methanesetrecipients: + methane, vstinner, ezio.melotti
2022-03-13 06:09:52methanesetmessageid: <>
2022-03-13 06:09:52methanelinkissue47000 messages
2022-03-13 06:09:51methanecreate