Marc-Andre Lemburg <m...@egenix.com> added the comment:
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 :-) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43552> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com