lanthaler / JsonLD

JSON-LD processor for PHP
MIT License
335 stars 62 forks source link

Double-quotes need to be escaped in NQuads serialization #81

Open frmichel opened 6 years ago

frmichel commented 6 years ago

Hi Markus,

When a string in the JSON-LD document contains escaped double-quotes, like in "Here is a \"string\n", then the double quotes are no longer escaped in the NQuads serialization. I fixed it in https://github.com/lanthaler/JsonLD/blob/master/NQuads.php by changing this line

$result` .= '"' . $quad->getObject()->getValue() . '"';

into

$result .= '"' . str_replace ( '"', '\"', $quad->getObject()->getValue() ). '"';

I did not test other serializations but it is likely that the same issue occurs.

Regards, Franck.