> On Jan 8, 2015, at 4:43 AM, Charles Jenkins <cejw...@gmail.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to