[Tutor] unsupported characters

Kent Johnson kent37 at tds.net
Sun Aug 17 22:53:23 CEST 2008


On 8/17/08, Robert Johansson <robert.johansson at math.umu.se> wrote:

> Hi, I have problems using characters from the Swedish language. I tried the
> following in IDLE under MacOS X leopard (running Python 2.5.1)  :

> S='ö'
> Displaying error message: "unsupported characters in input".

To use non-ascii characters in Python code you have to declare the
encoding of the source file with a comment such as
# coding=UTF-8

See http://python.org/dev/peps/pep-0263/

Kent


More information about the Tutor mailing list