[Python-Dev] directive statement (PEP 244)
Fred L. Drake, Jr.
fdrake@acm.org
Mon, 16 Jul 2001 16:09:24 -0400 (EDT)
Guido van Rossum writes:
> Well, I believe that for XML everybody (editors and other processors)
> looks in the same place, right?
It also assumes a pretty strict set of expected characters: If you
don't have UTF-8, you have:
[byte-order-mark] "<?xml " [version-spec] [encoding-spec]
[standalog-spec] "?>"
Basically, the encoding can be discovered very easily given an
assumption about legal content. Once that assumption doesn't hold,
the encoding can't be discovered reliably.
We could probably make a pretty reasonable statement of how to
auto-detect enough so that Python files could have an encoded
declaration (however we spell it), but it's hard to beat the
assumption of mandated structure. (Some assumption, huh? ;)
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Digital Creations