Show More
@@ -395,8 +395,10 b' def jsonescape(s):' | |||||
395 |
|
395 | |||
396 | >>> jsonescape('this is a test') |
|
396 | >>> jsonescape('this is a test') | |
397 | 'this is a test' |
|
397 | 'this is a test' | |
398 |
>>> jsonescape('escape characters: \\0 \\x0b \\ |
|
398 | >>> jsonescape('escape characters: \\0 \\x0b \\x7f') | |
399 |
'escape characters: \\\\u0000 \\\\u000b \\\\ |
|
399 | 'escape characters: \\\\u0000 \\\\u000b \\\\u007f' | |
|
400 | >>> jsonescape('escape characters: \\t \\n \\r \\" \\\\') | |||
|
401 | 'escape characters: \\\\t \\\\n \\\\r \\\\" \\\\\\\\' | |||
400 | >>> jsonescape('a weird byte: \\xdd') |
|
402 | >>> jsonescape('a weird byte: \\xdd') | |
401 | 'a weird byte: \\xed\\xb3\\x9d' |
|
403 | 'a weird byte: \\xed\\xb3\\x9d' | |
402 | >>> jsonescape('utf-8: caf\\xc3\\xa9') |
|
404 | >>> jsonescape('utf-8: caf\\xc3\\xa9') | |
@@ -411,6 +413,7 b' def jsonescape(s):' | |||||
411 | for x in xrange(32, 256): |
|
413 | for x in xrange(32, 256): | |
412 | c = chr(x) |
|
414 | c = chr(x) | |
413 | _jsonmap[c] = c |
|
415 | _jsonmap[c] = c | |
|
416 | _jsonmap['\x7f'] = '\\u007f' | |||
414 | _jsonmap['\t'] = '\\t' |
|
417 | _jsonmap['\t'] = '\\t' | |
415 | _jsonmap['\n'] = '\\n' |
|
418 | _jsonmap['\n'] = '\\n' | |
416 | _jsonmap['\"'] = '\\"' |
|
419 | _jsonmap['\"'] = '\\"' |
General Comments 0
You need to be logged in to leave comments.
Login now