On Thu, Feb 11, 2021 at 7:35 PM Inada Naoki <songofaca...@gmail.com> wrote:

> The PEP helps developers living on UTF-8 locale to find missing
> `encoding="utf-8"` bug.
> This type of bug is very common, and many Windows users are suffered
> by the bug when reading JSON, YAML, TOML, Markdown, or any other UTF-8
> files.

I think this is where we have been talking past each other.

You seem to be assuming that the programmer knows the correct
encoding, presumably because they (or their program) wrote it.  You
then assume that they neglected to mention the encoding out of
forgetfulness, perhaps because on their system, everything is always
UTF-8.  This clearly does happen, but the people who would make this
mistake most often -- they probably wouldn't think to test their code
under a special mode that catches only this.  (They might run a linter
that looked for all sorts of problems, including this.)

I instead assume that the programmer really doesn't know the encoding,
because the file is supplied by the user.  (The user may not know
either, since it is really supplied by some other program, but ...
neither python nor the programmer knows for sure.)  In this case, the
warning is not just a false alarm, but is actively misleading.

-jJ
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/LHMFNFIOATO46NVOVCUOKFQCRWCZLY7M/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to