# HG changeset patch
# User Augie Fackler <r...@durin42.com>
# Date 1505519012 14400
#      Fri Sep 15 19:43:32 2017 -0400
# Node ID 33c529f19fdf5dbecc7e2853e8eabaac4cc347e2
# Parent  34469e4e2187381259d78ec0a35c2dd5b0e9e85a
encoding: ensure getutf8char always returns a bytestr, never an int

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -458,9 +458,9 @@ def getutf8char(s, pos):
     '''
 
     # 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
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to