summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Aastrand Grimnes <gromgull@gmail.com>2012-12-05 14:33:12 +0100
committerGunnar Aastrand Grimnes <gromgull@gmail.com>2012-12-05 14:33:12 +0100
commitc05c1a8634c49be09540f46bc0fb313351d45f66 (patch)
tree12898ea19c2d37bf97c6b9ad00091a937f3adc02
parentb30f590ed6fe042a4e49e920be1d467f4d9d8adc (diff)
downloadrdflib-c05c1a8634c49be09540f46bc0fb313351d45f66.tar.gz
fix for escaping last quote of long literals. fixes #239.
-rw-r--r--rdflib/term.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/rdflib/term.py b/rdflib/term.py
index 0f37ba0f..8d43b13e 100644
--- a/rdflib/term.py
+++ b/rdflib/term.py
@@ -857,6 +857,9 @@ class Literal(Identifier):
if '"""' in self:
# is this ok?
encoded = encoded.replace('"""','\\"\\"\\"')
+ if encoded[-1]=='"' and encoded[-2]!='\\':
+ encoded=encoded[:-1]+'\\'+'"'
+
return '"""%s"""' % encoded.replace('\r','\\r')
else:
return '"%s"' % self.replace('\n','\\n').replace('\\', '\\\\'