From: Robin Redeker (elmex_at_[hidden])
Date: 2008-03-20 20:35:15
On Thu, Mar 20, 2008 at 10:10:07PM +0100, Esteve Fernandez wrote:
> - the JSON spec is quite simple, but given that it's a subset of YAML
> (actually Syck parses JSON as well), should it support it in the future as
Actually JSON is not really a subset of YAML, see also the documentation
of the Perl module of Marc Lehmann, who wrote a fully standards
compliant JSON parser in (C, bound to Perl):
Look at the comparsion in the section 'YAML and JSON'.
> - what about Unicode? I know that Boost.Regex supports Unicode if compiled
> against ICU and the JSON spec states that everything must be in Unicode
> (correct me if I'm wrong)
Yes, the JSON spec states that JSON is Unicode text, encoded in (any)
Unicode encoding (usually UTF-8). However, there is one hard part when
writing a JSON parser, you have to take care to handle the \uXXXX
literals in strings correctly. The JSON spec (RFC 4627,
http://www.ietf.org/rfc/rfc4627.txt ) states in section 2.5:
To escape an extended character that is not in the Basic
Multilingual Plane, the character is represented as a
twelve-character sequence, encoding the UTF-16 surrogate pair.
So, for example, a string containing only the G clef character
(U+1D11E) may be represented as "\uD834\uDD1E".
So care must be taken not to overlook this small detail.
> - TinyJSON and JSON.Spirit both use a MIT-like license (JSON.Spirit is
> licensed under CPOL). The Boost license is compatible with them but, could it
> pose a problem? There's JSONcpp  as well, which is public domain.
I wrote a JSON parser in C++, which I didn't release yet, which should
be almost 100% compliant with the JSON RFC. However, I defined my own
bytebuffer class with special UTF-8 handling, as I only have to deal
with UTF-8 in my problem domain.
But I could release the code under the boost license anytime if someone
is interested. But I guess for Boost inclusion there still has to be
done some work.
-- Robin Redeker | Deliantra, the free code+content MORPG elmex_at_[hidden] / r.redeker_at_[hidden] | http://www.deliantra.net http://www.ta-sa.org/ |
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk