Re: Am I Reinventing the Wheel? (Part I)
Re: Am I Reinventing the Wheel? (Part I)
- Subject: Re: Am I Reinventing the Wheel? (Part I)
- From: Jens Alfke <email@hidden>
- Date: Thu, 08 Jan 2015 09:30:30 -0800
> On Jan 8, 2015, at 4:43 AM, Charles Jenkins <email@hidden> wrote:
>
> 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!
No, it's fine for XML text to contain non-ASCII Unicode characters. The problem in your case was probably that the doctype string at the start of the document didn't properly declare the text encoding.
What you want to do is write the XML as UTF-8 and add the proper annotation to that effect in the doctype. (Sorry, it's been years since I worked with XML so I don't remember the exact syntax for doing this.)
The only characters that MUST be escaped in XML text are "<" and "&".
—Jens
_______________________________________________
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