Using Unicode scripts

Thomas Heller theller at
Fri Jul 18 12:12:38 CEST 2003

"yzzzzz" <yzzzzz at> writes:

> Hi,
> I am writing my python programs using a Unicode text editor. The files are
> encoded in UTF-8. Python's default encoding seems to be Latin 1 (ISO-8859-1)
> or maybe Windows-1252 (CP1252) which aren't compatible with UTF-8.
> For example, if I type print "é", it prints é. If I use a unicode string:
> a=u"é" and if I choose to encode it in UTF-8, I get 4 Latin 1 characters,
> which makes sense if the interpreter thinks I typed in u"é".
> How can I solve this problem?
> Thank you
> PS. I have no problem using Unicode strings in Python, I know how to
> manipulate and convert them, I'm just looking for how to specify the default
> encoding for the scripts I write.

Use Python 2.3, and read PEP 263.


More information about the Python-list mailing list