user-pic

hochgurgler

  • Commented on How should a JSON parser handle character strings?
    In answer to your original question: How should a JSON parser handle character strings with non-ASCII characters? My answer would be: If you pass the character string to an interface which provides byte-decoding sugar on top of the deserialisation, then...
  • Commented on How should a JSON parser handle character strings?
    Point of terminology: When I say "serialisation", I mean that a data structure is converted into a flat one-dimentional array of somethings, in this case (Unicode) characters. "deserialisation" is the converse. I think we are at an impasse here. I...
  • Commented on How should a JSON parser handle character strings?
    OK. It seems that the every other experienced Perl developer in the world is happy with the way the JSON module is prepared to deserialise from, and serialise to, character strings as well as byte strings. Only Pete Sergeant has...
Subscribe to feed Recent Actions from hochgurgler

  • schmorp commented on How should a JSON parser handle character strings?

    I may be a bit late, but I am mostly with Pete here...

    JSON parsers often accept JSON texts in various encodings - utf-8 is obviously very common. They sometimes also accept unencoded JSON, which, IMHO, isn't valid JSON text (a perl string isn't "encoded in unicode", it *is* unicode, which isn't encoded in any way).

    So apart from changing "ASCII" to "characters with codes >255", Pete is right: if a JSON parser is asked to decode UTF-8 encoded JSON text, then it should (at least optionally) signal an error on invalid input. \x{2222} is invalid in utf-8 encoded json text (as w…

Subscribe to feed Responses to Comments from hochgurgler

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.