[Python-Dev] #pragmas in Python source code

Paul Prescod paul@prescod.net
Wed, 12 Apr 2000 14:33:14 -0500


Ka-Ping Yee wrote:
> 
>...
>
> Eek indeed.  I'm tempted to suggest we drop the multiple-encoding
> issue (i can hear the screams now).  

The XML rule is one encoding per file. One thing that I think that they
did innovate in (I had nothing to do with that part) is that entities
encoded in something other than UTF-8 or UTF-16 must start with the
declaration: "<?xml encoding='utf-8'?>". This has two benefits:

By looking at the first four bytes of the file we can differentiate
between several different encoding "families" (Shift-JIS-like,
UTF-8-like, UTF-16-like, ...) and then we can tell the *precise*
encoding by looking at the encoding attribute.
-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
"Ivory towers are no longer in order. We need ivory 
networks. Today, sitting quietly and thinking is the 
world's greatest generator of wealth and prosperity."
 - http://www.bespoke.org/viridian/print.asp?t=140