classification
Title: Add utf8 alias for email charsets
Type: Stage:
Components: Library (Lib) Versions: Python 2.7, Python 2.6, Python 2.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, bgamari, maxua, tony_nelson (4)
Priority: Keywords: patch

Created on 2008-12-02 13:17 by maxua, last changed 2009-05-05 16:55 by bgamari.

Files
File name Uploaded Description Edit Remove
charset-utf8-alias.patch maxua, 2008-12-02 13:17
Messages (3)
msg76738 - (view) Author: (maxua) Date: 2008-12-02 13:17
When using MIME email package you can specify "utf8" as the encoding. It
will be accepted but it is not rendered correctly in some MUA. E.g. Mac
OS X Mail.app doesn't display it properly while Google Gmail does.

It is confusing since Python itself happily understands both utf8 and utf-8.

The patch adds "utf8" as an alias to "utf-8" encoding which means user
won't need to think twice.

Test case:
from email.MIMEText import MIMEText

msg = MIMEText(u'\u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430')
msg.set_charset('utf8')
print msg.as_string()
msg85329 - (view) Author: Tony Nelson (tony_nelson) Date: 2009-04-03 20:35
This seems entirely reasonable, helpful, and in accord with the mapping
of ascii to us-ascii.  I recommend accepting this patch or a slightly
fancier one that would also do "utf_8".

There are pobably other encoding names with the same issue of being
accepted by Python but not be understood by other email clients.

This issue also affects 2.6.1 and 2.7trunk.  I haven't checked 3.x.
msg87254 - (view) Author: Ben Gamari (bgamari) Date: 2009-05-05 16:55
Has this patch been merged yet?
History
Date User Action Args
2009-05-05 16:55:28bgamarisetnosy: + bgamari
messages: + msg87254
2009-04-03 20:36:41tony_nelsonsetversions: + Python 2.6, Python 2.7
2009-04-03 20:35:33tony_nelsonsetnosy: + barry, tony_nelson
messages: + msg85329
2009-03-30 22:56:23ajaksu2linkissue1685453 dependencies
2009-01-29 23:37:26hayposetnosy: - haypo
2008-12-02 13:54:22hayposetnosy: + haypo
2008-12-02 13:17:11maxuacreate