首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐学习书目
›
Python Cookbook
›
Using Google App Engine
推荐下载
›
Latest Google App Engine SDK
其他兼容技术
›
AppScale
V2EX
›
Google App Engine
incoming email中文乱码,有好的解决办法不?
sqbing
·
2011-03-27 00:27:20 +08:00
· 5135 次点击
这是一个创建于 5126 天前的主题,其中的信息可能已经有所发展或是发生改变。
是的,收到的Email,取email_message.subject,如果中间有中文,必定乱码
显示大致为=?GB2312?B?17yxuM+01OjLr771?=
表象来看,中文被GB2312编码了
各位有好的解决办法不?
乱码
中文
Email
4 条回复
•
1970-01-01 08:00:00 +08:00
1
sqbing
OP
2011-04-07 02:43:20 +08:00
试过了decode('gb2312'),也试过decode('gb18030'),都无法把文字正确解析出来
请教各位如何解决这样的问题
文字编码啊,python啊……
2
sqbing
OP
2011-04-10 15:49:28 +08:00
哎,最后还是自己找到了解决办法,各位啊各位...
email的subject字段会被预编码,python的email模块有相应的解析函数
3
Livid
MOD
2011-04-10 18:09:13 +08:00
Email subject 那里需要先用 base64 解码。
4
sqbing
OP
2011-04-10 20:54:20 +08:00
@
Livid
我试过,不用,python的email.header.decode_header()函数解决了我的问题
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
1572 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 21ms ·
UTC 16:42
·
PVG 00:42
·
LAX 09:42
·
JFK 12:42
Developed with
CodeLauncher
♥ Do have faith in what you're doing.