minirst: make encoding.encoding unicodes to pass into encode() and decode()
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 12 Mar 2017 07:09:18 +0530
changeset 31318 1c3352d7eaf2
parent 31317 0bd32d7c9002
child 31319 42a7195541a1
minirst: make encoding.encoding unicodes to pass into encode() and decode()
mercurial/minirst.py
--- a/mercurial/minirst.py	Sun Mar 12 06:59:37 2017 +0530
+++ b/mercurial/minirst.py	Sun Mar 12 07:09:18 2017 +0530
@@ -26,6 +26,7 @@
 from .i18n import _
 from . import (
     encoding,
+    pycompat,
     util,
 )
 
@@ -59,10 +60,10 @@
     # ASCII characters other than control/alphabet/digit as a part of
     # multi-bytes characters, so direct replacing with such characters
     # on strings in local encoding causes invalid byte sequences.
-    utext = text.decode(encoding.encoding)
+    utext = text.decode(pycompat.sysstr(encoding.encoding))
     for f, t in substs:
         utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
-    return utext.encode(encoding.encoding)
+    return utext.encode(pycompat.sysstr(encoding.encoding))
 
 _blockre = re.compile(br"\n(?:\s*\n)+")