[Pythonmac-SIG] Carbon.CoreFoundation - null-terminated unicode strings??

Jack Jansen Jack.Jansen at cwi.nl
Sat Mar 13 18:24:48 EST 2004


On 12 Mar 2004, at 20:38, has wrote:

> Bob wrote:
>
>>> print [c for c in  
>>> (fURL.CFURLCopyFileSystemPath(CF.kCFURLPOSIXPathStyle).CFStringGetUni 
>>> code())]
>>>
>>> --> [u'/', u'A', u'p', u'p', u'l', u'i', u'c', u'a', u't', u'i',  
>>> u'o', u'n', u's', u'/', u'T', u'e', u'x', u't', u'E', u'd', u'i',  
>>> u't', u'.', u'a', u'p', u'p', u'\x00'] -- why is last character  
>>> 0x00???
>>
>> You should be using the toPython method to bridge any Carbon.CF  
>> instance:
>
> Sorted. Thanks. (One of the hazards of not knowing the API. Any  
> documentation available?)

It's still a bug: Apparently the C routine CFStringGetUnicode() returns  
a null-terminated unicode string, and the wrapper (or, in other words,  
its author, or, in other words, me:-) didn't know about this.

Could you file a bug report, please?
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  
Goldman




More information about the Pythonmac-SIG mailing list