[Python-Dev] Support of UTF-16 and UTF-32 source encodings
Paul Moore
p.f.moore at gmail.com
Sun Nov 15 14:26:59 EST 2015
On 15 November 2015 at 16:40, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> What PEP 263 did do was to specify that non-ASCII-compatible encodings
> are not supported by the PEP 263 mechanism for declaring the encoding
> of a Python source program. That's because it looks for a "magic
> number" which is the ASCII-encoded form of "coding:" in the first two
> lines. It doesn't rule out alternative mechanisms for encoding
> detection (specifically, use of the UTF-16 "BOM" signature); it just
> doesn't propose implementing them.
That was my initial thought. But combine this with the statement from
the language docs that the default encoding when there is no PEP 263
encoding specification is UTF-8 (or ASCII in Python 2) and there's no
valid way that I can see that a UTF-16 encoding could be valid (short
of a formal language change).
Anyway, Guido has spoken, so I'll leave it there.
Paul
More information about the Python-Dev
mailing list