[Twisted-web] small json improvements

Eric Faurot eric.faurot at gmail.com
Mon Sep 5 01:56:05 MDT 2005


On 9/4/05, Jp Calderone <exarkun at divmod.com> wrote:

> This will break for strings containing ASCII control bytes (pretty much anything with ordinal value less than 32).  It will also break for strings containing bytes above 127.  If Python byte strings are supported, it should be in an 8-bit clean manner.  The one possible alternative to this I'm considering is to treat them as ASCII-encoded character strings, decode them as such, and then apply the unicode serialization rules to the result.

All I wanted was to be able to serialize 'regular' strings
conveniently. Of course
strings containing non-printable chars should be handled differently.

> Unicode serialization support is, of course, incomplete.

Could you elaborate on this? I'm not sure to understand the issue here.
What are javascript/browser requirements regarding unicode?

> Why add support to json.serialize() for this?  Why not just not use json.serialize()?  The goal of json is to pass data around, not executable code.

Well, what I originally had in mind was to rely on json to call methods on the
client, bypassing the livepage.js thing that I find confusing. I was not aware
of your callRemote branch. Now it looks really perfect.

Eric.


More information about the Twisted-web mailing list