使用 App Engine Python 接收非 ASCII 电子邮件会导致奇怪的字符编码
我正在使用 Google App Engine Python 接收电子邮件并将其存储在数据存储中。
class LogSenderHandler(InboundMailHandler):
def receive(self, mail_message):
logging.info("Received a message from: " + mail_message.sender)
当我收到来自 ASCII 地址的电子邮件时,一切正常:
Me [[email ;protected]] 存储为 Me [[email protected]]
但是,如果发件人值包含非 - ascii 字符,存储的数据值如下所示:
Mr Kröber [[电子邮件受保护]] 存储为=?ISO-8859-1?Q?Mr_Kr=F6ber?= [[电子邮件受保护]]
I'm receiving emails with the Google App Engine Python and storing those in the datastore.
class LogSenderHandler(InboundMailHandler):
def receive(self, mail_message):
logging.info("Received a message from: " + mail_message.sender)
When I receive an email from an ASCII address, everything works fine:
Me [[email protected]] is stored as Me [[email protected]]
However, if the sender values contains non-ascii chars, the data value stored looks like this:
Mr Kröber [[email protected]] is stored as =?ISO-8859-1?Q?Mr_Kr=F6ber?= [[email protected]]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
主题根据 RFC 2047 进行编码。请参阅 电子邮件 模块。
下面是将主题解码为 Unicode 的示例:
The subject is encoded according to RFC 2047. See the Internationalized headers section of the email module.
Here is an example decoding the subject to Unicode: