NS String doesn't encode all XML characters that require encoding
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
What steps will reproduce the problem?
1. Take a string such as Karl's iPad
2. Wrap this as NSString and encode this to XML
3. View the output
What is the expected output? What do you see instead?
Instead of encoding this, the value is output as-is.
What version of the product are you using? On what operating system?
1.8
Please provide any additional information below.
See notes here
http://stackoverflow.com/questions/1091945/where-can-i-get-a-list-of-the-xml-doc
ument-escape-characters
Original issue reported on code.google.com by karldmo...@gmail.com
on 3 Sep 2014 at 9:59
Google Code Exporter commented
Original comment by daniel.dreibrodt
on 22 Sep 2014 at 9:15
- Changed state: Accepted
Google Code Exporter commented
The accepted answer on that stackoverflow page you linked to is actually not
correct, or let's say not precise. XML allows the ' and " as node content, they
only need to be escaped when they appear in attribute values. As the XML
property list format does not use attributes, a situation where a ' or "
needs to be escaped does not occur. The characters that must be escaped in node
content are & and <. This is taken care of by the library as it wraps any
strings containing these characters into CDATA sections, where the > character
is also escaped.
For definite information on that topic see section 2.4 of the latest XML
specification at http://www.w3.org/TR/xml/#syntax.
Original comment by daniel.dreibrodt
on 23 Sep 2014 at 5:19
- Changed state: Invalid