py3: cast character set to bytes
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 11 Feb 2018 18:50:24 -0800
changeset 36119 6ea7f1c10c81
parent 36118 9e47bfbeb723
child 36120 54dfb65e2f82
py3: cast character set to bytes The returned value from this function is eventually fed into email.charset.Charset.__init__. However, the standard library appears to handle both string types in Python 2 and 3. So there shouldn't be any problem returning a bytes here. Differential Revision: https://phab.mercurial-scm.org/D2167
mercurial/mail.py
--- a/mercurial/mail.py	Sun Feb 11 18:47:19 2018 -0800
+++ b/mercurial/mail.py	Sun Feb 11 18:50:24 2018 -0800
@@ -187,7 +187,7 @@
 
 def codec2iana(cs):
     ''''''
-    cs = email.charset.Charset(cs).input_charset.lower()
+    cs = pycompat.sysbytes(email.charset.Charset(cs).input_charset.lower())
 
     # "latin1" normalizes to "iso8859-1", standard calls for "iso-8859-1"
     if cs.startswith("iso") and not cs.startswith("iso-"):