Submitter | Yuya Nishihara |
---|---|
Date | Jan. 16, 2016, 12:33 p.m. |
Message ID | <a3c68ee9fac119b70c0b.1452947633@mimosa> |
Download | mbox | patch |
Permalink | /patch/12791/ |
State | Accepted |
Commit | ffa599f3f5034eb8ebe3ab945a00b5dbf52add2f |
Headers | show |
Comments
On Sat, 2016-01-16 at 21:33 +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1452936601 -32400 > # Sat Jan 16 18:30:01 2016 +0900 > # Node ID a3c68ee9fac119b70c0b515081f161fb708deca7 > # Parent 0029c2bebc23182c34f83fa22abde1d5d4aebc51 > encoding: escape U+007F (DEL) character in JSON I've queued this one, thanks. -- Mathematics is the supreme nostalgia of our time.
Patch
diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -395,8 +395,10 @@ def jsonescape(s): >>> jsonescape('this is a test') 'this is a test' - >>> jsonescape('escape characters: \\0 \\x0b \\t \\n \\r \\" \\\\') - 'escape characters: \\\\u0000 \\\\u000b \\\\t \\\\n \\\\r \\\\" \\\\\\\\' + >>> jsonescape('escape characters: \\0 \\x0b \\x7f') + 'escape characters: \\\\u0000 \\\\u000b \\\\u007f' + >>> jsonescape('escape characters: \\t \\n \\r \\" \\\\') + 'escape characters: \\\\t \\\\n \\\\r \\\\" \\\\\\\\' >>> jsonescape('a weird byte: \\xdd') 'a weird byte: \\xed\\xb3\\x9d' >>> jsonescape('utf-8: caf\\xc3\\xa9') @@ -411,6 +413,7 @@ def jsonescape(s): for x in xrange(32, 256): c = chr(x) _jsonmap[c] = c + _jsonmap['\x7f'] = '\\u007f' _jsonmap['\t'] = '\\t' _jsonmap['\n'] = '\\n' _jsonmap['\"'] = '\\"'