equal
deleted
inserted
replaced
134 |
134 |
135 Recognized keywords: |
135 Recognized keywords: |
136 :encoding: resulting string encoding (default: utf-8) |
136 :encoding: resulting string encoding (default: utf-8) |
137 ''' |
137 ''' |
138 encoding = opts.get('encoding','utf-8') |
138 encoding = opts.get('encoding','utf-8') |
139 escape_chars = ((u'\\', ur'\\'), (u'\t', u'\\t'), (u'\r', u'\\r'), |
139 escape_chars = ((u'\\', u'\\\\'), (u'\t', u'\\t'), (u'\r', u'\\r'), |
140 (u'\n', u'\\n')) |
140 (u'\n', u'\\n')) |
141 for char, replace in escape_chars: |
141 for char, replace in escape_chars: |
142 value = value.replace(char, replace) |
142 value = value.replace(char, replace) |
143 if isinstance(value, unicode): |
143 if isinstance(value, unicode): |
144 value = value.encode(encoding) |
144 value = value.encode(encoding) |