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.14:12:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Is it about the current implementation of the PEP 597, or are you thinking at the future Python which would use UTF-8 by default?

I had forgot to consider about UTF-8 mode while finishing PEP 597. If possible, I want to ignore UTF-8 mode when `encoding="locale"` is specified from Python 3.10.
Otherwise, behavior will be changed between Python 3.10 and 3.11.

> Currently, getpreferredencoding(False) respects the behavior that you described, no?

getpreferredencoding(False) respects UTF-8 mode. That's what PEP 597 said (because the PEP don't define behavior in UTF-8 mode) and GH-19481 implements. 

But it is not what I want for now. I want to ignore UTF-8 mode when `encoding="locale"` is specified.

This is almost "only in Windows" issue, and users can use `encoding="mbcs"` in Windows-only script.

But `encoding="locale"` is new and recommended way to specify using "locale" encoding explicitly. When user specify "locale" encoding explicitly, I think we should respect it regardless UTF-8 mode.
Date User Action Args
2021-03-19 14:12:25methanesetrecipients: + methane, lemburg, vstinner, eryksun
2021-03-19 14:12:25methanesetmessageid: <>
2021-03-19 14:12:25methanelinkissue43552 messages
2021-03-19 14:12:25methanecreate