How to unpack data to unicode string?
Fredrik Lundh
fredrik at pythonware.com
Mon Jun 4 10:08:44 EDT 2001
Martin Bless wrote:
> I'm doing a bit of analyzing TrueType files. (BTW, there's some good
> information at www.microsoft.com/typography). There can be chunks of
> unicode data inside truetype files which I can extract via slicing:
>
> rawText = data[start:end]
>
> 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")
also take a look at TTX/TTLib:
http://www.letterror.com/code/ttx/index.html
</F>
<!-- o'reilly's "python standard library" now available:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->
More information about the Python-list
mailing list