2016-11-10 | Paul Boddie | raw files shortlog changelog graph | Encode whitespace characters. | |
encoders.py (file) |
1.1 --- a/encoders.py Thu Nov 10 18:49:15 2016 +0100 1.2 +++ b/encoders.py Thu Nov 10 23:20:12 2016 +0100 1.3 @@ -338,7 +338,7 @@ 1.4 if isinstance(value, (int, float)): 1.5 return str(value) 1.6 else: 1.7 - return '"%s"' % str(value).replace('"', '\\"') 1.8 + return '"%s"' % str(value).replace('"', '\\"').replace("\n", "\\n").replace("\t", "\\t").replace("\r", "\\r") 1.9 1.10 def encode_literal_instantiator(path): 1.11