On 9/15/20 1:41 PM, Dave Cridland wrote: > On Tue, 15 Sep 2020 at 10:08, Florian Schmaus <[email protected] > <mailto:[email protected]>> wrote: > > On 9/14/20 9:28 PM, Sam Whited wrote: > > What escaping mechanism, the JSON one or the XML one (probably the > JSON > > one to avoid weird double-escaping issues)? > > I wonder if this does matter. > > The tricky part are code points that do not need to be escaped in JSON, > but are invalid and not escapeable in XML 1.0. Those need to be escaped > in the JSON representation, as JSON allows any code point to be escaped > (RFC 7159 § 7 "Any character may be escaped"). > > I don't know if those exists. > > > I don't know that there are any characters that cannot be escaped in XML > 1.0, are there?
The control characters U+0000 - U+001F for example, but this should be true for all code points that re not in the 'Char' production rule of XML 1.0 [1]. The aforementioned control characters must only appear escaped in JSON, so we are fine here. What is left are the surrogate blocks, for which the same is true, and the byte order mark (U+FEFF) which is "discouraged" in JSON. > Besides, does it matter how they're escaped anyway if there's a choice? I don't think so. > Once the data in pulled from XML and then from JSON, the original data > will be unescaped fine, surely, whichever way it's been escaped? And the same should be true for the reverse direction. > Maybe I just don't understand what this normative text is trying to mandate. I am also at the point where I wonder if any normative text is required in the specification, because any valid JSON code point sequence can be represented as XML character data. At least, I could not come up with a counter example. If you know one, then please share it. Sure, your XML serialization routine has to take care of XML escaping, but this is true for everything you feed to it, JSON or not. Although it may be nice to have an implementation hint in the spec. - Florian 1: https://www.w3.org/TR/REC-xml/#NT-Char
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Standards mailing list Info: https://mail.jabber.org/mailman/listinfo/standards Unsubscribe: [email protected] _______________________________________________
