Convert to big5 to unicode
xiejw
xiejw0217 at gmail.com
Thu Sep 7 05:09:58 EDT 2006
Install the codecs. In Debain, you can do :
apt-get install python-cjkcodecs
Then, it is easy to encode ( I use 'gb2312' ) :
str = '我们'
u = unicode(str,'gb2312')
The convertion is done and you can get the string of UTF-8:
str_utf8 = u.encode("utf-8")
You can get the original string:
str_gb = u.encode("gb2312")
GM 写道:
> Dear all,
>
> Could you all give me some guide on how to convert my big5 string to
> unicode using python? I already knew that I might use cjkcodecs or
> python 2.4 but I still don't have idea on what exactly I should do.
> Please give me some sample code if you could. Thanks a lot
>
> Regards,
>
> Gary
More information about the Python-list
mailing list