[Pythonmac-SIG] strange behavior with NSArray and python unicode types

Jon Rosebaugh chairos at gmail.com
Sat Aug 13 09:10:45 CEST 2005


I have a class used to store data. In order to save and load the data,
I convert it into a NSArray as shown below:

NSArray.arrayWithArray_([self.Type, self.CreationTime,
self.ModificationTime, self.Name, self.Labels, self.Data])

self.Data is a unicode string. For some reason, its value does not get
placed in the array. Instead, it's replaced with the empty string.
However, if I replace self.Data with str(self.Data), it works. The
PyObjC documentation indicates that both normal strings and unicode
strings are subclasses of NSString, I'm quite baffled why one works
and the other doesn't. I'd really like to be able to save the unicode
data, so can someone please explain this to me?


More information about the Pythonmac-SIG mailing list