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

Re: #284724: Interpretation of NON-BREAK SPACE

Ross Burton wrote:
> On Sat, 2005-02-12 at 13:18 +0100, Frederic Peters wrote:
> > fred@trap:~$ python -c 'print "hello world"'
> >   File "<string>", line 1
> >     print "hello world"
> >          ^
> > SyntaxError: invalid syntax
> 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


Reply to: