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 eryksun, lemburg, methane, vstinner
Date 2021-03-19.13:57:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> I created this issue while reviewing the implementation of the PEP 597: PR 19481.

What I want is same to `locale.getpreferredencoding(False)` but ignores UTF-8 mode.

Background: PEP 597 adds new `encoding="locale"`option to open() and TextIOWrapper(). It is same to `encoding=None` for now, but it means using "locale encoding" explicitly.

But this is wrong in UTF-8 mode.

In UTF-8 mode, it's fine to `open(filename)` uses UTF-8. But I want to use "locale encoding" for `open(filename, encoding="locale")` because "locale" encoding is specified.

I don't want to add new meaning here. It should be same to `locale.getpreferredencoding(False)` without UTF-8 mode. So I need "cp%d" % GetACP() on Windows, not CRT locale encoding.

I don't care its name. both of sys.locale_encoding() and locale.get_encoding() are OK.
Date User Action Args
2021-03-19 13:57:29methanesetrecipients: + methane, lemburg, vstinner, eryksun
2021-03-19 13:57:29methanesetmessageid: <>
2021-03-19 13:57:29methanelinkissue43552 messages
2021-03-19 13:57:29methanecreate