Re: [PATCH] docs: license-rules.txt: cover SPDX headers on Python scripts
From: Mauro Carvalho Chehab
Date: Thu Sep 05 2019 - 16:07:40 EST
Em Thu, 5 Sep 2019 13:40:08 -0600
Jonathan Corbet <corbet@xxxxxxx> escreveu:
> On Thu, 5 Sep 2019 16:28:10 -0300
> Mauro Carvalho Chehab <mchehab+samsung@xxxxxxxxxx> wrote:
>
> > I don't think we can count that python 3 uses utf-8 per default.
> >
> > I strongly suspect that, if one uses a Python3 version < 3.7, it will
> > still default to ASCII.
> >
> > On a quick look, the new UTF-8 mode was added on PEP-540:
> >
> > https://www.python.org/dev/peps/pep-0540/
> >
> > Such change happened at Python 3.7.
>
> That PEP is to override the locale and use utf8 unconditionally. It
> says, with regard to the pre-PEP state:
>
> UTF-8 is also the default encoding of Python scripts, XML and JSON
> file formats.
>
> Unicode was the reason for much of the Python 3 pain; it seems unlikely
> that many installations are defaulting to ASCII anyway...?
Yeah, but I remember that UTF-8 handling changed a few times during python 3
releases. I didn't really tracked what happened, as I don't usually program
in Python. So, I'm actually relying on what I can find about that.
Looking at Python 3.0 release[1], it says:
"In many cases, but not all, the system default is UTF-8;
you should never count on this default."
[1] https://docs.python.org/3.0/whatsnew/3.0.html
So, at least on early Python 3 releases, the default may not be UTF-8.
I don't know about you, but, from time to time, people complain about
UTF-8 chars when I'm handling patches (last time was on a patch series
for Kernel 5.3 by a core dev in Australia, with was unable to apply a
patch from me with had some UTF-8 chars).
So, I'm pretty sure that some devs don't set the locale to UTF8 even
those days.
Thanks,
Mauro