[Python-Dev] Py_UNICODE madness
Nicholas Bastin
nbastin at opnet.com
Wed May 4 17:54:32 CEST 2005
On May 4, 2005, at 1:39 PM, M.-A. Lemburg wrote:
> 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:
Ah, I missed the codec registry lookup. Thanks.
I'll change the Py_UNICODE doc, if anyone has a suggestion as to what
to change it *to*...
--
Nick
More information about the Python-Dev
mailing list