Markus Roberts <[email protected]> writes:
>> A JSON "message" is explicitly specified to be a UTF-8 encoded string of
>> characters, so anything that tries to convey data outside that encoding
>> should rightly be pushed back by upstream.
>
> That's not the issue.
>
> We aren't talking about the message here, but the values of string fields
> inside the messages. They are supposed to be able to contain arbitrary
> binary data, and JSON even defines escapes (\x##, \U####, \###, etc.) for
> representing such data.
Not by my reading of RFC 4627 they are not: 2.5 defines a string as a sequence
of 'char' entities between double-quotes; char has escaped versions of Unicode
code-points, not arbitrary binary data:
All Unicode characters may be placed within the quotation marks except for
the characters that must be escaped: quotation mark, reverse solidus, and
the control characters (U+0000 through U+001F).
>> (I would probably have aimed to transform whatever 8-bit locale encoding
>> into UTF-8 and decoded back on the client side, so that *only* the very
>> edges of the system know anything about non-Unicode data.
>
> And in the case that the data is, say, a jpeg? Or an executable?
Then you have to base64 or otherwise encode it into a string-safe encoding.
Which, indeed, makes this a less than efficient way to transport arbitrary
binary data rather than slightly richer "text and tags" data.
> Not everything can be represented in UTF-8; sometimes you really do want to
> transfer something and have it show up identically on the other end and not
> have the transport layer do you any Unicode Favors(tm).
*nod* It is certainly an option to declare that puppet don't use JSON by the
spec, but rather JSON-plus-local-behaviours.
I would worry that this would lead to future cross-language issues because a
custom JSON-like encoder would be needed for every platform, but that may not
be a pressing concern in this case.
Daniel
--
✣ Daniel Pittman ✉ [email protected] ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.