equal
deleted
inserted
replaced
393 |
393 |
394 (escapes are doubled in these tests) |
394 (escapes are doubled in these tests) |
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 \\t \\n \\r \\" \\\\') |
398 >>> jsonescape('escape characters: \\0 \\x0b \\x7f') |
399 'escape characters: \\\\u0000 \\\\u000b \\\\t \\\\n \\\\r \\\\" \\\\\\\\' |
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') |
403 'utf-8: caf\\xc3\\xa9' |
405 'utf-8: caf\\xc3\\xa9' |
404 >>> jsonescape('') |
406 >>> jsonescape('') |
409 for x in xrange(32): |
411 for x in xrange(32): |
410 _jsonmap[chr(x)] = "\\u%04x" % x |
412 _jsonmap[chr(x)] = "\\u%04x" % x |
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['\"'] = '\\"' |
417 _jsonmap['\\'] = '\\\\' |
420 _jsonmap['\\'] = '\\\\' |
418 _jsonmap['\b'] = '\\b' |
421 _jsonmap['\b'] = '\\b' |