[I18n-sig] Re:Strawman Proposal: Encoding Declaration V 2

Frank Chen frank63@ms5.hinet.net
Sun, 11 Feb 2001 13:20:10 -0000


> Date: Sat, 10 Feb 2001 07:58:22 -0800
> From: Paul Prescod <paulp@ActiveState.com>
> Organization: ActiveState
> To: "i18n-sig@python.org" <i18n-sig@python.org>
> Subject: [I18n-sig] Strawman Proposal: Encoding Declaration V2
> 
> 
> A source file with an encoding declaration must only use non-ASCII bytes
> in places that can legally support Unicode characters. In Python 2.x the
> only place is within a Unicode literal. This restriction may be lifted
> in future versions of Python.

So, if one day I declare Big5 as the encoding, I cannot use any ASCII
character in my Python script?
Does it mean this?
if I set a = "characters='abc'", in the future it doesn't work? I need to
use Big5 characters 
as identifiers and also the contents of strings when encoding declaraction
is set to Big5?

> 
> The encoding declaration must be found before the first statement in the
> source file. The declaration is not a pragma. It does not show up in the
> parse tree and has no semantic meaning for the compiler itself. It is
> conceptually handled in a pre-compile "encoding sniffing" step. This
> step is also done using the ASCII encoding. 
> 

Like a preprocessor, to convert local encoding characters into Unicode
first?
And then feed it to the compiler?


Frank Chen