Problems in Using C-API for Unicode handling
Scott David Daniels
Scott.Daniels at Acm.Org
Tue Jan 13 12:22:39 EST 2009
abhi wrote:
> On Jan 13, 12:17 pm, Terry Reedy <tjre... at udel.edu> wrote:
>> abhi wrote:
>>> Hi,
>>> I am trying to handle Unicode objects in C (Python 2.5.2)....
> ... I want to convert this explicitely to utf-16....
You are trying to get Unicode and UTF-16, whereas you should think
of those two as distinct. UTF-16 is an encoded form (bytes) from
the abstract "Unicode is characters". What you want in Python is:
u'abc'.encode('UTF-16')
So look for something returning a string by invoking the decode method.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list