On Tue, May 17, 2011 at 1:21 PM, Dirkjan Ochtman <dirk...@ochtman.nl> wrote: > On Tue, May 17, 2011 at 19:40, Jeremy Dunck <jdu...@gmail.com> wrote: >> So, to start with, is there a maintainer for the json module, or how >> should I go about discussing implementing this solution? > > Your subject states that there is an actual bug in the json module, > but your message fails to mention any actual bug. Is this what you > mean? > > Python 2.7.1 (r271:86832, Mar 28 2011, 09:54:04) > [GCC 4.4.5] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import json >>>> print json.dumps(u'foo\u2028bar') > "foo\u2028bar"
Actually, that would be fine, and Bob's right that this is a non-issue with ensure_ascii=True (the default). His change upstream seems good for the ensure_ascii=False case. To be complete, this is what I meant: >>> s = '{"JSON":"ro cks!"}' # this string has a literal U+2028 in it >>> s '{"JSON":"ro\xe2\x80\xa8cks!"}' >>> import json >>> json.dumps(s) # fine by default '"{\\"JSON\\":\\"ro\\u2028cks!\\"}"' >>> json.dumps(s, ensure_ascii=False) # not fine with ensure_ascii=False '"{\\"JSON\\":\\"ro\xe2\x80\xa8cks!\\"}"' _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com