unicode converting

Diez B. Roggisch deetsNOSPAM at web.de
Tue Mar 15 11:46:48 EST 2005


Maxim Kasimov wrote:

> 
> there are a few questions i can find answer in manual:
> 1. how to define which is internal encoding of python unicode strings
> (UTF-8, UTF-16 ...) 

It shouldn't be your concern - but you can specify it using " ./configure
--enable-unicode=ucs2" or --enable-unicode=ucs4. You can't set it to utf-8
or utf-16.

> 2. how to convert string to UCS-2 

s = ... # some ucs-2 string
s.decode("utf-16")

might give you the right results for most cases:

http://mail.python.org/pipermail/python-dev/2002-May/024193.html


-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list