diff options
author | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2012-12-05 14:33:12 +0100 |
---|---|---|
committer | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2012-12-05 14:33:12 +0100 |
commit | c05c1a8634c49be09540f46bc0fb313351d45f66 (patch) | |
tree | 12898ea19c2d37bf97c6b9ad00091a937f3adc02 | |
parent | b30f590ed6fe042a4e49e920be1d467f4d9d8adc (diff) | |
download | rdflib-c05c1a8634c49be09540f46bc0fb313351d45f66.tar.gz |
fix for escaping last quote of long literals. fixes #239.
-rw-r--r-- | rdflib/term.py | 3 |
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('\\', '\\\\' |