On Wed, Jan 18, 2017 at 04:38:15PM +0100, Sven Van Caekenberghe wrote: > Being a superset means that you get a simple JSON parser (and even limited > writer) for free once you install STON (or once it is part of the Pharo > image, as it is now). It also means that we can fall back to the JSON spec as > a guide in discussion like this one. It also helps people understand what > STON is, by analogy but also differences with JSON. > > So my conclusion would be (while writing), always escape $\ and not $/, in > pure STON mode (the default), escape $' and not $", in JSON mode, escape $" > and not $'. Those would be the changes. Agreed ? >
Yes for JSON, I guess yes for STON. (For me STON is effectively opaque representation (because of its DFS strategy), so I don't care too much about how it is stored (as long as it is not binary)) Thanks! Peter > > Peter > > > >>> On 18 Jan 2017, at 15:25, Peter Uhnak <i.uh...@gmail.com> wrote: > >>> > >>> On Wed, Jan 18, 2017 at 11:11:06AM +0100, Christophe Demarey wrote: > >>>> > >>>>> Le 18 janv. 2017 à 09:51, Sven Van Caekenberghe <s...@stfx.eu> a écrit : > >>>>> > >>>>> Hi Christophe, > >>>>> > >>>>>> STON toString: 'g...@github.com:foo/bar.git’ => > >>>>>> ''g...@github.com:foo\/bar.git’' > >>>>>> It used to be ''g...@github.com:foo/bar.git’’. > >>> > >>>>> In other words, it was an implementation error (omission). Note that > >>>>> JSON also has this escape. > >>> > >>> Yes and no for JSON. > >>> > >>> Only " and \ has to be escaped. Escaping anything else will give it > >>> special meaning with the exception of / which will just produce the same > >>> thing, because it is a special snowflake. :) > >>> > >>> quoted from https://tools.ietf.org/html/rfc7159#section-7: > >>> > >>> - 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). > >>> - Alternatively, there are two-character sequence escape representations > >>> of some popular characters. > >>> > >>> "/" (U+002F) doesn't fall into control character range, but the > >>> alternative section does permit it escaping it. > >>> > >>> In other words, JSON strings "\/", and "/", and "\u002f" are equivalent. > >>> > >>> But JSON itself doesn't require you to escape "/" (just like you are not > >>> required to escape "hi" into "\u0068\u0069", although you can). > >>> > >>> Note that other systems do not escape / by default: > >>> > >>> (Pharo) > >>> NeoJSONWriter toString: 'g...@github.com:foo/bar.git' => > >>> "g...@github.com:foo/bar.git" > >>> > >>> (JavaScript) > >>> JSON.stringify('g...@github.com:foo/bar.git') => > >>> "g...@github.com:foo/bar.git" > >>> > >>> (Ruby) > >>> require 'json' > >>> puts 'g...@github.com:foo/bar.git'.to_json => > >>> "g...@github.com:foo/bar.git" > >>> > >>> Peter > >>> > >> > >> > > > >