[New-bugs-announce] [issue17906] Add a string error handler to JSON encoder/decoder

Serhiy Storchaka report at bugs.python.org
Sat May 4 16:38:28 CEST 2013

New submission from Serhiy Storchaka:

Inspired by simplejson issue [1] which is related to standard json module too. JSON parser 3.3+ and wide builds of 3.2- raise an error on invalid strings (i.e. with unpaired surrogate), while narrow builds and some third-party parsers. Wide builds are right, such JSON data is invalid. However it will be good to be optionally more permissive to input data. Otherwise it is not easy process such invalid data.

I propose to add an "error" parameter to JSON decoder and encoder with the same meaning as in string decoding/encoding. "strict" is default and "surrogatepass" corresponds to narrow builds (and non-strict third-party parsers).

[1] https://github.com/simplejson/simplejson/issues/62

assignee: serhiy.storchaka
components: Extension Modules, Library (Lib), Unicode
messages: 188364
nosy: bob.ippolito, ezio.melotti, pitrou, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Add a string error handler to JSON encoder/decoder
type: enhancement
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list