Re[Python-Dev] #pragmas in Python source code

M.-A. Lemburg mal@lemburg.com
Fri, 14 Apr 2000 23:29:48 +0200


"Andrew M. Kuchling" wrote:
> 
> >why not just assume that the *ENTIRE SOURCE FILE* uses a single
> >encoding, and let the tokenizer (or more likely, a conversion stage
> >before the tokenizer) convert the whole thing to unicode.
> 
> To reinforce Fredrik's point here, note that XML only supports
> encodings at the level of an entire file (or external entity). You
> can't tell an XML parser that a file is in UTF-8, except for this one
> element whose contents are in Latin1.

Hmm, this would mean that someone who writes:

"""
#pragma script-encoding utf-8

u = u"\u1234"
print u
"""

would suddenly see "\u1234" as output. If that's ok, fine with me...
it would make things easier on the compiler side (even though
I'm pretty sure that people won't like this).

BTW: I will be offline for the next week... I'm looking forward
to where this dicussion will be heading.

Have fun,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/