Skip to content

Commit

Permalink
fix for escaping last quote of long literals. fixes #239.
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgull committed Dec 5, 2012
1 parent b30f590 commit c05c1a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rdflib/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,9 @@ def _quote_encode(self):
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('\\', '\\\\'
Expand Down

0 comments on commit c05c1a8

Please sign in to comment.