a question about Chinese characters in a Python Program

Terry Reedy tjreedy at udel.edu
Mon Oct 20 14:10:05 EDT 2008


Liang Chen wrote:
> Hope you all had a nice weekend. 
> 
> I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type Chinese characters, but neverthelss is unable to show them up on screen. The follow is some of the error message I received after I logged off the program:
> 
> "Could not write output: <type "exceptions: UnicodeEncodeError'>, 'ascii' codec can't encode characters in position 0-1: ordinal not in range (128)"
> 
> Any suggestion will be appreciated.

Start with the Unicode HOWTO in the HOWTOs part of the Manual set.

For 2.6
http://docs.python.org/howto/unicode.html
For 3.0, which has been updated in spite of the warning
http://docs.python.org/dev/3.0/howto/unicode.html




More information about the Python-list mailing list