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 vstinner
Recipients vstinner
Date 2019-06-10.10:39:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1560163177.73.0.639513289421.issue37214@roundup.psfhosted.org>
In-reply-to
Content
Spin-off of INADA-san's PEP 597: I propose to emit a new EncodingWarning warning when the locale encoding is used implicitly.

I propose to add a new warning to be able to control how they are handled: either make them hard error (python3.9 -W error::EncodingWarning) or ignore them (python3.9 -W ignore::EncodingWarning).

Displaying these warnings by default or not is an open question discussed in PEP 597 discussion:
https://discuss.python.org/t/pep-597-use-utf-8-for-default-text-file-encoding/1819

I propose to only emit a warning which can be turned off easily to not bother people who don't care of encodings. There are many legit cases where a Python application works well in a control environment whereas it would break on any other environment, but the application is only used in one specific environment. For example, an application may only be run in a container which has a well defined locale and locale encoding, but will never be run on Windows, macOS, FreeBSD or HP-UX.

Writing portable code is *great*. But I'm not sure that *all* code must be portable. For example, it's also fine to use Python to write applications specific to Linux, again, for code only run in a controlled environment. Many companies have private projects which will never run outside their "walls" (outside their datacenters ;-)).
History
Date User Action Args
2019-06-10 10:39:37vstinnersetrecipients: + vstinner
2019-06-10 10:39:37vstinnersetmessageid: <1560163177.73.0.639513289421.issue37214@roundup.psfhosted.org>
2019-06-10 10:39:37vstinnerlinkissue37214 messages
2019-06-10 10:39:37vstinnercreate