Fix charset handling for text/html parts
This commit is contained in:
parent
bdb5842d75
commit
00ad5f864e
5
mbox2web
5
mbox2web
|
@ -207,7 +207,10 @@ def render_body(msg, extra=None):
|
|||
return bodytmpl.render(context)
|
||||
def render_text_html(msg, extra=None):
|
||||
htmlpart = HTMLPart(extra)
|
||||
htmlpart.feed(msg.get_payload(decode=True).decode(msg.get_charset() or "iso-8859-1"))
|
||||
ct_params = dict(msg.get_params())
|
||||
charset = ct_params.get("charset", "iso-8859-1")
|
||||
raw_text = msg.get_payload(decode=True).decode(charset, errors="replace")
|
||||
htmlpart.feed(raw_text)
|
||||
bodytmpl = jenv.get_template("body_text_html.html")
|
||||
context = {
|
||||
"body": jinja2.Markup(htmlpart.as_string())
|
||||
|
|
Loading…
Reference in New Issue