lanthaler / JsonLD

JSON-LD processor for PHP
MIT License
336 stars 61 forks source link

Failing to parse content with special chars #76

Open rhiaro opened 7 years ago

rhiaro commented 7 years ago

I'm using this with EasyRdf (@njh) and if I try to parse JSON-LD which contains unicode characters, it just halts, and I haven't managed to make it give me any errors yet. eg.

<?
$url = "https://linkedresearch.org/ldn/tests/inbox-compacted/changelog";
$response = file_get_contents($url);
var_dump($response);
echo "<hr/>";
$g = new EasyRdf_Graph($g);
$g->parse($response, 'jsonld');
var_dump($g->toRdfPhp());
?>

If you change $url to "https://linkedresearch.org/ldn/tests/inbox-compacted/announce", a JSON-LD document in otherwise the same format without any special characters, it works fine.

lanthaler commented 7 years ago

I don't know much about EasyRdf. Could you please check whether

echo JsonLD::toString(JsonLD::expand($url), true);

works? It works on my machine