On Mon, Feb 4, 2019 at 2:19 PM Jonas Schäfer <jo...@wielicki.name> wrote:

> This message constitutes notice of a Last Call for comments on
> XEP-0335.
>
> Title: JSON Containers
> Abstract:
> This specification defines an element to be used for encapsulating
> JSON data in XMPP.
>
> URL: https://xmpp.org/extensions/xep-0335.html
>
> This Last Call begins today and shall end at the close of business on
> 2019-02-19.
>
> Please consider the following questions during this Last Call and send
> your feedback to the standards@xmpp.org discussion list:
>
> 1. Is this specification needed to fill gaps in the XMPP protocol
> stack or to clarify an existing protocol?
>
> 2. Does the specification solve the problem stated in the introduction
> and requirements?
>
> 3. Do you plan to implement this specification in your code? If not,
> why not?
>
> 4. Do you have any security concerns related to this specification?
>
> 5. Is the specification accurate and clearly written?
>
> Your feedback is appreciated!
> _______________________________________________
> Standards mailing list
> Info: https://mail.jabber.org/mailman/listinfo/standards
> Unsubscribe: standards-unsubscr...@xmpp.org
> _______________________________________________
>

 It would be good if the specification noted the incompatibility between
JSON and XML definitions of what a character is, and certain characters
MUST be escaped be escaped via JSON escaping to be valid XML.

In XML 1.0:

> Char    ::=    #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
> [#x10000-#x10FFFF]
> /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
> */


In JSON (RFC 7159):

> char = unescaped /
>           escape (
>               %x22 /          ; "    quotation mark  U+0022
>               %x5C /          ; \    reverse solidus U+005C
>               %x2F /          ; /    solidus         U+002F
>               %x62 /          ; b    backspace       U+0008
>               %x66 /          ; f    form feed       U+000C
>               %x6E /          ; n    line feed       U+000A
>               %x72 /          ; r    carriage return U+000D
>               %x74 /          ; t    tab             U+0009
>               %x75 4HEXDIG )  ; uXXXX                U+XXXX
>       escape = %x5C              ; \
>       quotation-mark = %x22      ; "
>       unescaped = %x20-21 / %x23-5B / %x5D-10FFFF


So all control characters, surrogates and similar MUST be escaped via \X or
\uXXXX escapes in XML strings to allow lossless and valid passthrough of
all possible JSON content.

I'd mainly like this noted because a lot of implementors only think of
ASCII and normal characters when implementing such things, and edge case
bugs tend to sneak into the wild and cause compat issues.

Thanks,
Waqas
_______________________________________________
Standards mailing list
Info: https://mail.jabber.org/mailman/listinfo/standards
Unsubscribe: standards-unsubscr...@xmpp.org
_______________________________________________

Reply via email to