changeset 31318:1c3352d7eaf2

minirst: make encoding.encoding unicodes to pass into encode() and decode()
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 12 Mar 2017 07:09:18 +0530
parents 0bd32d7c9002
children 42a7195541a1
files mercurial/minirst.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)+")