[Python-Dev] Py_UNICODE madness

M.-A. Lemburg mal at egenix.com
Wed May 4 19:39:55 CEST 2005


Nicholas Bastin wrote:
> 
> On May 4, 2005, at 4:39 AM, M.-A. Lemburg wrote:
> 
>>> At the very least, if we can't guarantee the internal representation, 
>>> then the PyUnicode_FromUnicode API needs to go away, and be replaced 
>>> with something capable of transcoding various unicode inputs into the 
>>> internal python representation.
>>
>>
>> We have PyUnicode_Decode() for that. PyUnicode_FromUnicode is
>> useful and meant for working directly on Py_UNICODE buffers.
> 
> 
> Is this API documented anywhere?  (It's not in the Unicode Object 
> section of the API doc).  Also, this is quite inefficient if the source 
> data is in UTF-16, because it appears that I'll have to transcode my 
> data to utf-8 before I can pass it to this function, but I guess I'll 
> have to live with that.

Not at all. You pass in the pointer, the function does the rest:

http://docs.python.org/api/builtinCodecs.html

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, May 04 2005)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Python-Dev mailing list