Am I Reinventing the Wheel? (Part I)
Am I Reinventing the Wheel? (Part I)
- Subject: Am I Reinventing the Wheel? (Part I)
- From: Charles Jenkins <email@hidden>
- Date: Thu, 08 Jan 2015 07:43:14 -0500
"When you try to reinvent the wheel, most often what you end up with is a flat tire."
I need to deal with two issues that are probably already handled in some Cocoa API I just haven't found yet. This email asks about the first of these issues.
I'm writing data to XML. When you create a node and set its string contents, the node will happily accept whatever string you give and allow you to serialize information XML deserialization cannot then recreate. In my case, the string in question contained curled quotes. I could serialize and save the data—and if I remember correctly* the output looked good when I inspected the file on disk—but reading it back and deserializing it led to disaster! Right now I'm using NSString stringByAddingPercentEncoding: and having no further problems with curled quotes, but I'm sure that's a poor long-term solution.
*I encountered this problem a few weeks ago and put off a final solution by using the percent encoding.
Is there already a Cocoa API call that would convert a string to use HTML entities so I could safely put any string into an XML node?
—
Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden