Can I change a unicode char to gb2312 using python?

{-- Rot13 - Hateme ungrzr2 at ubatxbat.pbz
Thu Dec 20 00:18:56 EST 2001


"Kick" <store_li at sina.com> wrote in
news:9vq6d9$gvc5p$1 at ID-12869.news.dfncis.de: 

> I know that Java have a method that can manually encode string, like
> that, 
> 
> System.out.println(new String("some chinese char".getBytes()"GB2312"))
> 
> Is there any python function or method can do the same work?
> 
> Thanks for any help!
> 

Python cannot do GB codec. You have to convert your
chinese code to utf-8 or some other form of unicode
before handling them.

There is a iconv wrapper on the net. It helps if
you use unix.



More information about the Python-list mailing list