Re: You can give propertyListFromData: a C string!
Re: You can give propertyListFromData: a C string!
- Subject: Re: You can give propertyListFromData: a C string!
- From: Bill Bumgarner <email@hidden>
- Date: Sat, 27 May 2006 12:38:51 -0700
On May 27, 2006, at 11:24 AM, Jerry Krinock wrote:
So that I can clear my head and continue working on the REAL bug,
could
someone please confirm: (a) Am I nuts, or (b) did OpenStep
"serialize" an
NSString by simply pumping out its ASCII bytes?
A bare string is interpreted as a valid property list.
>>> from Foundation import *
>>> d = NSData.dataWithBytes_length_("string", len("string"))
>>> d
<73747269 6e67>
>>> plist =
NSPropertyListSerialization.propertyListFromData_mutabilityOption_format
_errorDescription_(d, NSPropertyListImmutable)
>>> plist
(u'string', 1, None)
This only works with old school property lists. XML property lists
have to have all that markup goo surrounding the 6 bytes of actual data.
See:
file:///Developer/ADC Reference Library/documentation/Cocoa/
Conceptual/PropertyLists/index.html#//apple_ref/doc/uid/10000048i
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden