This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: CFStringGetUnicode() returns null-terminated unicode string
Type: Stage:
Components: macOS Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jackjansen Nosy List: hhas, jackjansen
Priority: normal Keywords:

Created on 2004-03-14 10:22 by hhas, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg20209 - (view) Author: (hhas) Date: 2004-03-14 10:22
Carbon.CoreFoundation CFStringGetUnicode() wrapper returns a 
null-terminated unicode string. Example:

#######

#!/usr/local/bin/pythonw

import Carbon.CoreFoundation as CF
from appscript import LaunchServices

path = 'TextEdit.app'

fURL = LaunchServices.LSFindApplicationForInfo ('????', None, 
path)[1]

print [c for c in 
(fURL.CFURLCopyFileSystemPath(CF.kCFURLPOSIXPathStyle).CFSt
ringGetUnicode())]

--> [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???

#######
msg20210 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2004-07-15 14:26
Logged In: YES 
user_id=45365

Fixed, both for 2.4 and 2.3.X.
History
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40031
2004-03-14 10:22:59hhascreate