Author Brian.Merrell
Recipients Brian.Merrell, belopolsky, vstinner
Date 2011-03-14.17:31:41
SpamBayes Score 7.38338e-10
Marked as misclassified No
Message-id <1300123902.38.0.351714649212.issue11489@psf.upfronthosting.co.za>
In-reply-to
Content
>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().
History
Date User Action Args
2011-03-14 17:31:42Brian.Merrellsetrecipients: + Brian.Merrell, belopolsky, vstinner
2011-03-14 17:31:42Brian.Merrellsetmessageid: <1300123902.38.0.351714649212.issue11489@psf.upfronthosting.co.za>
2011-03-14 17:31:41Brian.Merrelllinkissue11489 messages
2011-03-14 17:31:41Brian.Merrellcreate