templatefilters: convert arguments to sysstrs for unicode() ctor
authorAugie Fackler <augie@google.com>
Thu, 01 Mar 2018 20:44:38 -0500
changeset 36592 9d71bd25554b
parent 36591 247e9bf4ecdc
child 36593 c4ccc73f9d49
templatefilters: convert arguments to sysstrs for unicode() ctor Differential Revision: https://phab.mercurial-scm.org/D2538
mercurial/templatefilters.py
--- a/mercurial/templatefilters.py	Fri Mar 02 07:14:59 2018 +0530
+++ b/mercurial/templatefilters.py	Thu Mar 01 20:44:38 2018 -0500
@@ -273,7 +273,7 @@
     """Any text. Returns the input text rendered as a sequence of
     XML entities.
     """
-    text = unicode(text, encoding.encoding, 'replace')
+    text = unicode(text, pycompat.sysstr(encoding.encoding), r'replace')
     return ''.join(['&#%d;' % ord(c) for c in text])
 
 @templatefilter('permissions')