a question about unicode in python

kyosohma at gmail.com kyosohma at gmail.com
Tue Jun 12 15:51:24 EDT 2007


On Jun 12, 12:29 pm, "Evan Klitzke" <e... at yelp.com> wrote:
> On 6/12/07, hzqij <hzqij1... at gmail.com> wrote:
>
> > i have a python source code test.py
>
> > # -*- coding: UTF-8 -*-
>
> As Marc pointed out, you should test the actual file encoding of the
> program to check that it is, in fact, UTF-8 encoded. If you're on a
> Unix/Linux system you should be able to test for a UTF-8 encoded file
> using the "file" command, e.g.
>
> evan at dhcp-10-10-7-101 ~ $ file ~/uni.py
> /home/evan/uni.py: UTF-8 Unicode text
>
> --
> Evan Klitzke <e... at yelp.com>

If you're using IDLE to edit the source with, you can set IDLE to
encode in utf8 by going to Options, Configure IDLE, General Tab, and
change the Default Source Encoding to utf-8.

Mike




More information about the Python-list mailing list