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 URL encoding when using Serializer.toN3 #290

Closed
y0va opened this issue Jan 17, 2019 · 1 comment
Closed

Double URL encoding when using Serializer.toN3 #290

y0va opened this issue Jan 17, 2019 · 1 comment

Comments

@y0va
Copy link

y0va commented Jan 17, 2019

Hi,

When I run this code:

var $rdf = require('rdflib');
var FOAF = $rdf.Namespace("http://xmlns.com/foaf/0.1/")
var iri = new URL('http://example.org/name/na me')

var sts = []
var graph = new $rdf.graph()

sts.push(new $rdf.Statement($rdf.Namespace(iri.href)('#notme'),FOAF('name'), 'Meier'))

graph.addAll(sts)

console.log(new $rdf.Serializer(graph).toN3(graph))

I get this output:

@prefix n: <http://example.org/name/na%2520me#>.
@prefix n0: <http://xmlns.com/foaf/0.1/>.

n:notme n0:name "Meier"

Which contains a double encoded whitespace (%2520).

Am I doing something wrong, or is this a bug? (I run rdflib 01.19.1 on node 11.0.0)

@y0va
Copy link
Author

y0va commented Jan 18, 2019

Upsi, much more wise to use $rdf.serialize:

$rdf.serialize(undefined, graph, 'http://example.org/name/', 'text/turtle')

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