changeset 36497:b2e54b257832

templatefilters: use encoding.unifromlocal/unitolocal() for py3 compatibility
author Yuya Nishihara <yuya@tcha.org>
date Thu, 01 Mar 2018 06:38:37 -0500
parents 7af7443877da
children b546181ae451
files mercurial/templatefilters.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatefilters.py	Fri Mar 02 00:00:41 2018 +0530
+++ b/mercurial/templatefilters.py	Thu Mar 01 06:38:37 2018 -0500
@@ -152,12 +152,12 @@
         while True:
             m = para_re.search(text, start)
             if not m:
-                uctext = unicode(text[start:], encoding.encoding)
+                uctext = encoding.unifromlocal(text[start:])
                 w = len(uctext)
                 while 0 < w and uctext[w - 1].isspace():
                     w -= 1
-                yield (uctext[:w].encode(encoding.encoding),
-                       uctext[w:].encode(encoding.encoding))
+                yield (encoding.unitolocal(uctext[:w]),
+                       encoding.unitolocal(uctext[w:]))
                 break
             yield text[start:m.start(0)], m.group(1)
             start = m.end(1)