电子邮件中的尾随等号(=) [英] Trailing equal signs (=) in emails

查看:64
本文介绍了电子邮件中的尾随等号(=)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用POP3从Gmail帐户下载邮件,并将其保存在SQLite数据库中以进行进一步处理:

I download messages from a Gmail account using POP3 and save them in a SQLite database for futher processing:

mailbox = poplib.POP3_SSL('pop.gmail.com', '995') 
mailbox.user(user) 
mailbox.pass_(password)

msgnum = mailbox.stat()[0]

for i in range(msgnum):
    msg = '\n'.join(mailbox.retr(i+1)[1])
    save_message(msg, dbmgr)

mailbox.quit()

但是,在数据库中查找时,除消息正文的最后一行(有效负载)以外的所有行都具有尾随等号.你知道为什么会这样吗?

However, looking in the database, all lines but the last one of the message body (payload) have trailing equal signs. Do you know why this happens?

推荐答案

弗雷德里克(Frederic)的链接将我引到了答案.该编码称为带引号的可打印"( wiki ),可以使用 quopri Python模块(文档):

Frederic's link lead me to the answer. The encoding is called "quoted printable" (wiki) and it's possible to decode it using the quopri Python module (documentation):

msg.decode('quopri').decode('utf-8')

这篇关于电子邮件中的尾随等号(=)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆