email.message_from_binary_file creates invalid RFC2047 encodings
未关闭
还没有人认领这个 Issue。
stdlib
topic-email
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
The following illustrates the issue.
>>> # Here's an example file
>>> with open('badx2.eml') as fp:
... print(fp.read())
...
From: "Sweepstakes Alert–Dyson Vacuum" <DysonVacuumSweeps@stellaryx.space>
body
>>> # Note that the `–` above is a unicode En Dash
>>> # Make a message object
>>> from email import message_from_binary_file
>>> with open('badx2.eml', 'rb') as fp:
... msg = message_from_binary_file(fp)
...
>>> # and look at it
>>> print(msg.as_string())
From: =?unknown-8bit?q?=22Sweepstakes_Alert=E2=80=93Dyson_Vacuum=22_=3CDysonVacuumSweeps=40stellaryx=2Espace=3E?=
body
>>> # Note that the email address is improperly included in the encoded word
CPython versions tested on:
3.13
Operating systems tested on:
Linux
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 email.message_from_binary_file 重现所示示例,并检查 email 包的标头编码路径。完成的标准是显示名称在编码时不会错误地包含电子邮件地址,并且有一个回归测试覆盖 Unicode en dash 情况。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100