Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • No, you have to encode it as ascii (or as latin1 if the other end of the transaction can be told about that).

    $ perl -MJSON::XS -MFile::Slurp -e '$g=read_file("add.gif"); print JSON::XS->new->ascii(1)->encode({file=>$g})' > json

    $ perl -MJSON::XS -MFile::Slurp -e '$g=read_file("json"); $d = decode_json($g); print $d->{file}' > gif

    $ diff add.gif gif

    -- ask bjoern hansen [], !try; do();

    • Encoding one property as ascii is portable? I didn't think JSON had a way to mark encoding for individual nodes.
      • I didn't read the ECMAScript spec, but according to then \u[four hex digits] is a valid way to specify a "character", so yes - I think so. It's still unicode, but you "munge" it to not have any high bits.


        -- ask bjoern hansen [], !try; do();