On Jun 3, 2009, at 11:12 AM, Oliver Hunt wrote:
1.) leading zeros are parsed as decimal numbers (octal seems like a
bug no matter what, per MarkM)
IE8 and V8's JSON implementation, and json2.js at json.org all
interpret 010, as octal (eg. 8), and 009 as 9
Those look like bugs ;-).
The "noctal" (0377 is 255 but 0800 is 800) in JS since 1995 is surely
the original bug, but we're stuck with it to some extent. We shouldn't
spread it to JSON.
The ES specs mostly try to ignore noctal and hope it goes away, which
can be a good strategy if there's a better mousetrap leading
developers away from the attractive nuisance. But no one intentionally
uses octal or noctal, AFAICT. Only perhaps by accident, and I know of
no real-world mistakes of this kind (but I can believe they're out
there still).
2.) trailing commas in objects and arrays are allowed ({"foo":
42,"bar":42,})
V8's JSON implementation also accepts [1,,,2]
Good for it! :-)
3.) tabs and linebreaks are allowed in JSON strings (but
JSON.stringify produces escape sequences, per spec)
My testing shows that only '\' (excluding actual escape sequences)
and '"' are prohibited -- all other values from 0-0xFFFF are allowed.
Seems like our bug.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss