How to process Chinese using Python?

C

chad

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> -*-

to the beginning of the code, as PEP 0263 seems to have suggested.

Any idea about processing east-asian languages, Chinese in particular?
 
P

Peter Otten

chad said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top