Chinese language support of Python?

Leon Wang guidance_shanghai at yahoo.com.cn
Sun Jul 7 18:25:53 EDT 2002


I found the best option: pythonwin, in win32 extension module,
including source editor and debugger!
Summarize the python for Chinese installation:
    1) Python package from python.org
    2) Win32all module from
http://starship.python.net/crew/mhammond/win32/
    3) ChineseCodecs module from
ftp://freebsd.sinica.edu.tw/pub/ycheng/python/ChineseCodecs1.2.0.tar.gz

I think these are the best solution so far. Use this to display
Chinese(GB) in Tkinter:
>>> root.title(unicode('中文',"eucgb2312_cn"))
and this in console:
>>> root.title('中文')

Thanks for all of your help!!
Leon Wang
> Meanwhile, you have the following options:
> 
> - Don't use IDLE to edit Python source code (but, say, notepad), and
>   only put Chinese text into string literals.
> - Set the default encoding in site.py to the encoding you want to use.
> - Apply patch 
>   http://sourceforge.net/tracker/index.php?func=detail&aid=508973&group_id=9579&atid=309579
> 
>   which allows you to declare the source encoding for IDLE.
> 
> In either case, you cannot use Chinese in Unicode literals. Instead,
> you should always use 
> 
>    unicode("chinese string", "chinese encoding")
> 
> For portability, and if your editors support it, I recommend to use
> UTF-8 as the "chinese encoding".
> 
> Regards,
> Martin



More information about the Python-list mailing list