Skip to content

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

@frmichel

Description

@frmichel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions