-
Notifications
You must be signed in to change notification settings - Fork 578
Closed
Description
hannes.g...@gmail.com, 2008-01-23T10:32:30.000Z
When I try to parse an N3, I get an error when a literal contains a \t. But \t is defined to be in N3 strings. I suspect the failure is in n3proc's unquote: >>> from rdflib.syntax.parsers.n3p.n3proc import unquote >>> unquote("\t") Traceback (most recent call last): File "", line 1, in File "build/bdist.linux-i686/egg/rdflib/syntax/parsers/n3p/n3proc.py", line 85, in unquote rdflib.syntax.parsers.n3p.n3proc.ParseError: Illegal literal character: '\t' Comment 1 by eike...@gmail.com This is actually correct, I believe, since "\t" should be escaped as r"\t". For example unquote(r"\t") will give you "\t" -- and unquote("\t") (AKA an actual tab character) will give the above error. In looking into this issue I did notice Literal's n3 method is not correctly escaping "\t". Literal("\t").n3() should be "\\t" which is the same as r"\t". Comment 2 by eike...@gmail.com Comment 3 by gromgull Eikeon is right - this seem to work fine {{{ g=rdflib.graph.Graph() g.parse(StringIO.StringIO(r' "Gunnar\tlikes chese". '), format="n3") print g.serialize() <_4:name>Gunnar likes chese }}}
Metadata
Metadata
Assignees
Labels
No labels