diff -r b3b4c487707c -r 53865692a354 mercurial/debugcommands.py --- a/mercurial/debugcommands.py Mon Mar 13 09:24:53 2017 -0700 +++ b/mercurial/debugcommands.py Wed Mar 15 23:06:50 2017 +0900 @@ -1514,8 +1514,8 @@ return not r else: for k, v in sorted(target.listkeys(namespace).iteritems()): - ui.write("%s\t%s\n" % (k.encode('string-escape'), - v.encode('string-escape'))) + ui.write("%s\t%s\n" % (util.escapestr(k), + util.escapestr(v))) @command('debugpvec', [], _('A B')) def debugpvec(ui, repo, a, b=None):