Brian Merrell <br...@merrells.org> added the comment:

>I am not sure this should be fixed in 2.x. Lone surrogates seem to >round-trip 
>just fine in 2.x and there likely to be existing code that >relies on this.

I generally agree but am then at a loss as to how to detect and deal with lone 
surrogates(eg "ignore", "replace", etc) in 2.x when interacting with 
services/libraries (such as Python's own json.loads) that take a stricter view.

>>  Shouldn't anything generated by json.dumps be parsed by json.loads?

>This on the other hand should probably be fixed by either rejecting >lone 
>surrogates in json.dumps or accepting them in json.loads or both.  >The last 
>alternative would be consistent with the common wisdom of >being conservative 
>in what you produce but liberal in what you accept.

We seem to be in the worst of both worlds right now as I've generated and 
stored a lot of json that can not be read back in.  Could the JSON library 
simply leverage Python's Unicode interpreter instead of performing its own 
validation?  We could pass it "ignore", "replace", etc.  Regardless, I think we 
certainly need to remove the strict JSON loads() validation especially when it 
isn't enforced by dumps().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11489>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to