comparison mercurial/mail.py @ 36118:9e47bfbeb723

py3: cast decode() argument to system string The actual types here may be mixed due to string literals and variables from other modules. So a cast is necessary. Differential Revision: https://phab.mercurial-scm.org/D2166
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 18:47:19 -0800
parents 1407c42b302c
children 6ea7f1c10c81
comparison
equal deleted inserted replaced
36117:c02771617a70 36118:9e47bfbeb723
204 cs = ['us-ascii', 'utf-8', encoding.encoding, encoding.fallbackencoding] 204 cs = ['us-ascii', 'utf-8', encoding.encoding, encoding.fallbackencoding]
205 if display: 205 if display:
206 return mimetextqp(s, subtype, 'us-ascii') 206 return mimetextqp(s, subtype, 'us-ascii')
207 for charset in cs: 207 for charset in cs:
208 try: 208 try:
209 s.decode(charset) 209 s.decode(pycompat.sysstr(charset))
210 return mimetextqp(s, subtype, codec2iana(charset)) 210 return mimetextqp(s, subtype, codec2iana(charset))
211 except UnicodeDecodeError: 211 except UnicodeDecodeError:
212 pass 212 pass
213 213
214 return mimetextqp(s, subtype, "iso-8859-1") 214 return mimetextqp(s, subtype, "iso-8859-1")