Convert text body from mail charset to the current locale's charset
before passing it to the mailcap filter.
caps = mailcap.getcaps()
content_type = msg.get_content_type()
+ if content_type.startswith('text/'):
+ charset = msg.get_content_charset()
+ else:
+ charset = None
filename = tempfile.mktemp()
command = None
return s
outfile = open(filename, 'wb')
+ if charset and isinstance(s, bytes):
+ s = s.decode(charset, "replace")
if not isinstance(s, bytes):
s = s.encode(g.default_encoding, "replace")
outfile.write(s)