Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • A JavaScript string is defined as a "sequence of zero or more 16-bit unsigned integer values." (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf)

    and http://json.org/ [json.org] says "A string is a collection of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. [...]. A string is very much like a C or Java string."

    Does that mean JSON "doesn't have native support for binary data"? Depends on your needs I guess (and whether you control the sending and/or receiving ends).

    If you have a series of bytes that you want to get from A to B via JSON I'd assume you could treat them as a series of unicode code points, for the sake of encoding. If the destination is JavaScript then they'll end up as a series of 16-bit unicode code points internally, but that shouldn't matter as all the code points are 256. Basically think in terms of the logical "sequence of integers that happen to be 256" rather than the physical "sequence of adjacent 8 bit bytes".

    My experience with JSON & JavaScript is minimal (currently) and I've not actually needed to do this yet, but I may do soon so I'm keen for someone to point out any flaws in my thinking.