changeset 34207:112f118ecb00

encoding: ensure getutf8char always returns a bytestr, never an int
author Augie Fackler <raf@durin42.com>
date Fri, 15 Sep 2017 19:43:32 -0400
parents 90b0e1639fd4
children 310c151a0705
files mercurial/encoding.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/encoding.py	Fri Sep 15 19:43:02 2017 -0400
+++ b/mercurial/encoding.py	Fri Sep 15 19:43:32 2017 -0400
@@ -458,9 +458,9 @@
     '''
 
     # find how many bytes to attempt decoding from first nibble
-    l = _utf8len[ord(s[pos]) >> 4]
+    l = _utf8len[ord(s[pos:pos + 1]) >> 4]
     if not l: # ascii
-        return s[pos]
+        return s[pos:pos + 1]
 
     c = s[pos:pos + l]
     # validate with attempted decode