JSON decoding problem under Spidermonkey

This is a question about an implementation problem affecting citeproc-js, and
not a CSL issue properly speaking. I apologize for troubling list
members for whom it is not of interest. The question is relevant to
tests of quotation marks, which are currently failing under
Spidermonkey, but passing under Rhino.

At the command line, the two interpreters produce different results
for an escaped unicode string, such as would be delivered via JSON:

s = “\u201c”

s = “\u201c”

Rhino returns an open double-quote character with the command above.
In the same terminal window, Spidermonkey returns an ASCII space. Am
I missing some incantation needed to get Spidermonkey to properly
decode escaped Unicode characters? Alternatively, is there some other
means of reliably getting the decoded characters into a Spidermonkey
JS instance?

Any pointers greatly appreciated.

Frank

Why not just use the characters directly?

Bruce

This is a question about an implementation problem affecting citeproc-js, and
not a CSL issue properly speaking. I apologize for troubling list
members for whom it is not of interest. The question is relevant to
tests of quotation marks, which are currently failing under
Spidermonkey, but passing under Rhino.

At the command line, the two interpreters produce different results
for an escaped unicode string, such as would be delivered via JSON:

s = “\u201c”

s = “\u201c”

Rhino returns an open double-quote character with the command above.
In the same terminal window, Spidermonkey returns an ASCII space. Am
I missing some incantation needed to get Spidermonkey to properly
decode escaped Unicode characters? Alternatively, is there some other
means of reliably getting the decoded characters into a Spidermonkey
JS instance?

Why not just use the characters directly?

Ha. Done. The grind.py script was dumping the tests with escaped
unicode strings, and I was stuck on the idea that these needed to be
unescaped. In simplejson, setting
simplejson.dumps(str,ensure_ascii=False) preserves the literal unicode
chars. Everything works now, under Python 2.5 with simplejson.

Does the Python 2.6 module also have the ensure_ascii option?

Frank

Does the Python 2.6 module also have the ensure_ascii option?

Yes, see:

http://docs.python.org/library/json.html

Bruce

Does the Python 2.6 module also have the ensure_ascii option?

Yes, see:

http://docs.python.org/library/json.html

Got it, sorry for the extra traffic. And thanks for the nudge on
this, it got things back on track.