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

Bob Ippolito bob at redivi.com
Sat Aug 13 09:54:00 CEST 2005


On Aug 12, 2005, at 9:10 PM, Jon Rosebaugh wrote:

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

That shouldn't happen, I doubt that it's actually the situation you  
describe.  Post something reproducible and someone will look at it.

-bob



More information about the Pythonmac-SIG mailing list