[redland-dev] [Raptor RDF Syntax Library 0000606]: "JSON" format outputs invalid Unicode escapes

Mantis Bug Tracker mantis-bug-sender at librdf.org
Fri Dec 11 17:27:15 EST 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.librdf.org/mantis/view.php?id=606 
====================================================================== 
Reported By:                rspeer
Assigned To:                
====================================================================== 
Project:                    Raptor RDF Syntax Library
Issue ID:                   606
Category:                   utilities
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Syntax Name:                json 
====================================================================== 
Date Submitted:             2015-12-11 14:27
Last Modified:              2015-12-11 14:27
====================================================================== 
Summary:                    "JSON" format outputs invalid Unicode escapes
Description: 
Redland, particularly its command-line "rapper" utility, claims to output JSON.
However, when the input contains non-BMP Unicode characters (which are common in
multilingual linked data such as Lexvo), it outputs invalid JSON.

Redland uses a Python-esque "\U0001201D" escape sequence to represent a non-BMP
character, but such escape sequences are not defined in JavaScript or in the
json.org standard.

Alternatives that would be valid JSON would include the surrogate sequence
"\ud808\udc1d", or the UTF-8 literal "

Steps to Reproduce: 
Download http://www.lexvo.org/resources/lexvo_latest.rdf.gz, then run these
commands:

    gunzip lexvo_latest.rdf.gz
    rapper -i rdfxml -o json-triples lexvo_latest.rdf > lexvo_latest.json

lexvo_latest.json is now an invalid JSON file. Confirm by using a JSON utility
such as jq (https://stedolan.github.io/jq/):

    jq '.triples' < lexvo_latest.json

This gives:

    parse error: Invalid escape at line 271749, column 520
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-12-11 14:27 rspeer         New Issue                                    
======================================================================



More information about the redland-dev mailing list