Le 18 janv. 2017 à 09:51, Sven Van Caekenberghe <sven@stfx.eu> a écrit :
Hi Christophe,
On 18 Jan 2017, at 09:30, Christophe Demarey <christophe.demarey@inria.fr> wrote:
Hi,
I just noticed that STON encoding of forward slashes changed.
STON toString: 'git@github.com:foo/bar.gitâ => ''git@github.com:foo\/bar.gitâ'
It used to be ''git@github.com:foo/bar.gitââ.
Is it on purpose?
Thanks, Christophe
Yes, it was 'changed' in
Name: STON-Core-SvenVanCaekenberghe.78 Author: SvenVanCaekenberghe Time: 20 November 2016, 7:48:23.799323 pm UUID: ee198da8-80e8-4944-ba9b-dffae331c57c Ancestors: STON-Core-SvenVanCaekenberghe.77
with as comment
Fix the encoding of forward slash ($/). This was already in the (external) documentation.
In other words, it was an implementation error (omission). Note that JSON also has this escape.
ok.
Now, in retrospect, the question is 'should all possible escapes be done when writing ?', especially for $/ this is a maybe a bit too much, the same for tab. For the other named escapes, the case is clearer: they are either necessary $" and $\ or they make things clearer and less error prone, $b, $n, $f and $r.
There is already the #asciiOnly option that decides whether non-ASCII Unicode characters are encoded with \uHHHH or not.
I guess you are human editing STON config files, right ?
I have kind of STON config files (STON files holding metadata) and I try to keep them user readable / editable. By example, I do not serialize an url directly with STON because it shows ZnUrl implementation details but I rather serialize the url string. That said, indeed, I would like to avoid escape characters if they are not needed. Maybe there could be an option for that? Also, maybe I overuse STON that should just be a raw serializer and do not try to « tune » the output to get a user friendly serialization. Thanks for the answer. Christophe