Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
frmichel opened this issue Dec 6, 2017 · 0 comments
Open

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

frmichel opened this issue Dec 6, 2017 · 0 comments

Comments

@frmichel
Copy link
Contributor

frmichel commented Dec 6, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant