Patchwork [2,of,2,py3] minirst: make encoding.encoding unicodes to pass into encode() and decode()

login
register
mail settings
Submitter Pulkit Goyal
Date March 12, 2017, 1:40 a.m.
Message ID <5ffb1db4197ad77c7ea9.1489282837@pulkit-goyal>
Download mbox | patch
Permalink /patch/19130/
State Accepted
Headers show

Comments

Pulkit Goyal - March 12, 2017, 1:40 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1489282758 -19800
#      Sun Mar 12 07:09:18 2017 +0530
# Node ID 5ffb1db4197ad77c7ea9449b7e4f40c7cfa9cebc
# Parent  8a0ab8f9e6a51af702e9477664c640ae271c05d2
minirst: make encoding.encoding unicodes to pass into encode() and decode()

Patch

diff -r 8a0ab8f9e6a5 -r 5ffb1db4197a 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)+")