diff -r b4abc438a8c9 -r 1c601df9894c mercurial/encoding.py --- a/mercurial/encoding.py Sun Sep 03 17:28:47 2017 +0900 +++ b/mercurial/encoding.py Sun Sep 03 15:54:29 2017 +0900 @@ -508,6 +508,7 @@ except UnicodeDecodeError: pass + s = pycompat.bytestr(s) r = "" pos = 0 l = len(s) @@ -560,6 +561,7 @@ # points to be escaped. Instead, we use our handy getutf8char # helper again to walk the string without "decoding" it. + s = pycompat.bytestr(s) r = "" pos = 0 l = len(s)