How to process Chinese using Python?

Peter Otten __peter__ at web.de
Fri Mar 5 13:45:46 EST 2004


chad wrote:

> I don't know how to make use of the encodings and what encoding I
> should use.  The PEP 0263 page is not helpful.
> 
> Whenever I have Chinese characters in my Python code, I get this
> warning message:
> 
> C:\Python23\codes>python stripper.py
> sys:1: DeprecationWarning: Non-ASCII character '\xc0' in file
> stripper.py on lin
> e 22, but no encoding declared; see
> http://www.python.org/peps/pep-0263.html for
>  details
> 
> when I attempt to execute it.
> 
> It still warns even if I add
> 
> # -*- coding: <utf-8> -*-

Try changing that to

# -*- coding: utf-8 -*-

Peter



More information about the Python-list mailing list