json parse: special characters

Bug #866757 reported by Dennis Knochenwefel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
Medium
Dennis Knochenwefel

Bug Description

for some special characters (formfeed, carriage return and backspace), json:parse returns some strange entities:

import module namespace json = "http://www.zorba-xquery.com/modules/json";

declare variable $local:json :=
   '{ "special-chars": {
         "unicode": "\u007B",
         "quote": "\"",
         "backslash": "\\",
         "backspace": "\b",
         "formfeed": "\f",
         "newline": "\n",
         "carriage return": "\r",
         "horizontal tab": "\t",
         "solidus": "\/"
      }
    }';

json:parse($local:json)

Revision history for this message
Dennis Knochenwefel (dennis-knochenwefel) wrote :

I think, that the parse part is even correct (the strange entities come from the xml serialization). But it's still a problem because this query returns false:

import module namespace json = "http://www.zorba-xquery.com/modules/json";

declare variable $local:json :=
   '{ "special-chars": {
         "unicode": "\u007B",
         "quote": "\"",
         "backslash": "\\",
         "backspace": "\b",
         "formfeed": "\f",
         "newline": "\n",
         "carriage return": "\r",
         "horizontal tab": "\t",
         "solidus": "\/"
      }
    }';

json:serialize(json:parse($local:json)) eq $local:json

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

Fixed in r9443.

@Dennis: can you please verify and close the bug? Thanks.

Revision history for this message
Dennis Knochenwefel (dennis-knochenwefel) wrote :

Perfect! thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.