On Fri, Feb 12, 2021 at 12:45 PM Jim J. Jewett <jimjjew...@gmail.com> wrote:
>
> 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.

Not always, but many times.

>  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.)
>

Some Python experts can write `export PYTHONWARNENCODING=1` in their .bashrc.
They can find such mistakes not only in their codes but also in
libraries they are using.
Since they are experts, they can understand the warning and report it
to the library author correctly.

So this option helps library authors even if they don't use this option.


> 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

This option is opt-in.  People don't understand what this warning
means should not opt-in the warning.

Regards,
-- 
Inada Naoki  <songofaca...@gmail.com>
_______________________________________________
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/KLYUYKLHWCTTK7HOYNPDRPRS6WIQQU7K/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to