[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: #284724: Interpretation of NON-BREAK SPACE

On Sat, 2005-02-12 at 13:54 +0100, Frederic Peters wrote:
> > Don't you need to tell Python what charset you are using if you don't
> > use ASCII?
> This is PEP 263 <http://www.python.org/peps/pep-0263.html>, its
> purpose is to declare the encoding of Python source files but it
> actually only applies to strings, not to the code itself.
> fred@trap:~$ cat test.py 
> # -*- coding: UTF-8 -*-
> print 'Hello world'
> fred@trap:~$ python test.py 
>   File "test.py", line 2
>     print 'Hello world'
>          ^
> SyntaxError: invalid syntax

As yes.
Quoting from file:///usr/share/doc/python2.3-doc/html/ref/lexical.html:

        Python uses the 7-bit ASCII character set for program text. New
        in version 2.3: An encoding declaration can be used to indicate
        that string literals and comments use an encoding different from
So using anything other than ASCII space, tab, and formfeed is incorrect

Ross Burton                                 mail: ross@burtonini.com
                                          jabber: ross@burtonini.com
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: