fix encoding
This commit is contained in:
parent
65e8d98646
commit
f1fc5a24c1
|
@ -56,13 +56,12 @@ for i in range(messages, messages-N, -1):
|
||||||
content_type = msg.get_content_type()
|
content_type = msg.get_content_type()
|
||||||
body = msg.get_payload(decode=True).decode()
|
body = msg.get_payload(decode=True).decode()
|
||||||
if content_type == "text/plain":
|
if content_type == "text/plain":
|
||||||
open(filepath, "w").write(body)
|
open(filepath, "wb").write(body.encode('utf8'))
|
||||||
|
|
||||||
if content_type == "text/html":
|
if content_type == "text/html":
|
||||||
md = markdownify(body)
|
md = markdownify(body)
|
||||||
if md[:4] == 'html':
|
if md[:4] == 'html':
|
||||||
md = md[4:]
|
md = md[4:]
|
||||||
|
|
||||||
open(filepath, "wb").write(md.encode('utf8'))
|
open(filepath, "wb").write(md.encode('utf8'))
|
||||||
|
|
||||||
imap.close()
|
imap.close()
|
||||||
|
|
Loading…
Reference in New Issue