Carsten Bormann writes:

> ...

> For IETF purposes, JSON text is always UTF-8 encoded, so there is no
> difference.

I don't agree, based on my reading of 8259.  It's clear that a single
U+0076 character can occur in "JSON text", but as such that text is
_not_ a byte sequence

>> The problem you've encountered arises when one tries to illustrate
>> UTF-8 byte sequences in an unambiuous way in, for example, an IETF
>> RFC.
>
> You can always write the whole thing in hex.

Not in the kind of spec we're discussing here, I would think.

> But typically that is really needed only in very few places, and I think we 
> can assume that readers of this document understand JSON at least a little 
> bit.

> Apart from that, you can use JSON’s \u escapes (but then you get
> different JSON text).

Indeed, that's part of what I was trying to make sure is properly
illustrated.

>> My recommendation is to follow RFC 8259's lead, and use e.g. "%xC3"
>> for that purpose.
>
> Ah, that notation in RFC 8259 is ABNF (STD68), which is completely
> different from JSON instances, and therefore mixing this up is
> highly confusing.

I do understand that, but I thought it was less confusing than the
intermediary that, as it happens, node.js offers, namely

  '["_26bc4LT-ac6q2KI6cBW5es", "family_name", "Möbius"]'

> You are using ABNF in byte mode here (normally we use ABNF to define 
> sequences of Unicode scalar values).
> In ABNF byte mode, your array above would be:
>
> my-string = "[" %x22 %s"26bc4LT-ac6q2KI6cBW5es" %x22 ", " %x22 
> %s"family_name" %x22 ", " %x22 %s"M" %xc3 %xb6 %s"bius" %x22 "]"
>
> That is about as confusing as you can get, so please don’t do that.

Agreed.

> (You can write this JSON text as a JSON-encoded JSON text string data item 
> while staying in ASCII:
> "[\"26bc4LT-ac6q2KI6cBW5es\", \"family_name\", \"M\u00f6bius\"]"
> )

Indeed. I had that in an earlier draft of my review, with the comment
"But this is ugly and not particularly helpful.

ht
-- 
       Henry S. Thompson, School of Informatics, University of Edinburgh
                10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND
                           e-mail: h...@inf.ed.ac.uk
                      URL: https://www.ltg.ed.ac.uk/~ht/
 [mail from me _always_ has a .sig like this -- mail without it is forged spam]

_______________________________________________
OAuth mailing list -- oauth@ietf.org
To unsubscribe send an email to oauth-le...@ietf.org

Reply via email to