How to unpack data to unicode string?

Martin Bless m.bless at gmx.de
Mon Jun 4 12:06:29 EDT 2001


[Fredrik Lundh]:

>> Now, how do I do the transformation of rawText
>> '\x00N\x00o\x00r\x00m\x00a\x00l'  ->  u'Normal' ?
>
>try this:
>
>    u = unicode(s, "utf-16-be")

Great, it works. BTW, Python handling of unicode stuff seems to be
hard stuff for Python newbies, as there aren't many useful examples,
most of the sources are in c++ and not Python and comments - where
present - more seem to address those who already know.

>
>also take a look at TTX/TTLib:
>
>    http://www.letterror.com/code/ttx/index.html

Yes, thanks. Very interesting.





More information about the Python-list mailing list