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 lemburg
Recipients eryksun, lemburg, methane, vstinner
Date 2021-03-19.15:22:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On 19.03.2021 16:15, Inada Naoki wrote:
> `locale.getpreferredencoding()` is special, because it "Return the encoding used for text data, according to user preferences. User preferences are expressed differently on different systems, and might not be available programmatically on some systems, so this function only returns a guess."

I already wrote earlier that we should deprecate this API, since the
overloading with different meanings in the past has turned it into
an unreliable source of information. At this point, it returns
"some encoding, which may or may not be what you want" :-)

We need to get things separated out clearly again: the locale
module is for the lib C locale state. What Python does in the
I/O layers has to be defined and queries at the appropriate
places elsewhere (e.g. os, sys or io modules).

>> As mentioned, both should ideally be synchronized, though, so
>> UTF-8 mode in Python should trigger setting a UTF-8 encoding
>> via setlocale().
> There is PEP 538 already :)

Great :-)
Date User Action Args
2021-03-19 15:22:29lemburgsetrecipients: + lemburg, vstinner, methane, eryksun
2021-03-19 15:22:29lemburglinkissue43552 messages
2021-03-19 15:22:29lemburgcreate