I use wxPythonWIN32-2.4.2.4u-Py23.exe now.I can type Chinese characters in
wxStyledTextCtrl,and very thing is OK.But if I use settext method to set
Chinese characters in the controls,I must first decode the characters to
unicode,just like:
a='你好'
a.decode('mbcs')
u'\u4f60\u597d'
It's boring to decode every string,and is there a convenient way to do the
decoding task for me,such as a global setting?
BTW,how to know whether the wxpython is unicode version or not in an application?
···
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
It's boring to decode every string,and is there a convenient way to do the
decoding task for me,such as a global setting?
You could try using unicode literals. I tend to use UTF-8 files rather
than mbcs as many editors (including those I write ) handle UTF-8 more
consistently and it is easy to convince Python to read in your file as
UTF-8:
# -*- coding: utf-8 -*-
a='你好'
print a
print repr(a)
u = a.decode('utf-8')
print repr(u)
b=u'你好'
print repr(b)