minirst: explicitly decode substitutions
authorMatt Mackall <mpm@selenic.com>
Fri, 13 Jun 2014 14:14:02 -0500
changeset 21745 4c62478be2ea
parent 21744 395e29928db2
child 21746 2d47d81c79fb
minirst: explicitly decode substitutions Caught by Augie and sys.setdefaultencoding("undefined")
mercurial/minirst.py
--- a/mercurial/minirst.py	Fri May 30 12:12:03 2014 -0700
+++ b/mercurial/minirst.py	Fri Jun 13 14:14:02 2014 -0500
@@ -56,7 +56,7 @@
     # on strings in local encoding causes invalid byte sequences.
     utext = text.decode(encoding.encoding)
     for f, t in substs:
-        utext = utext.replace(f, t)
+        utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
     return utext.encode(encoding.encoding)
 
 _blockre = re.compile(r"\n(?:\s*\n)+")