[issue21095] EmailMessage should support Header objects
Brandon Rhodes
report at bugs.python.org
Sat Mar 29 04:33:26 CET 2014
New submission from Brandon Rhodes:
Currently, the new wonderful EmailMessage class ignores the encoding specified in any Header objects that are provided to it.
import email.message, email.header
m = email.message.Message()
m['Subject'] = email.header.Header('Böðvarr'.encode('latin-1'), 'latin-1')
print(m.as_string())
Subject: =?iso-8859-1?q?B=F6=F0varr?=
m = email.message.EmailMessage()
m['Subject'] = email.header.Header('Böðvarr'.encode('latin-1'), 'latin-1')
print(m.as_string())
Traceback (most recent call last):
...
TypeError: 'Header' object does not support indexing
If the EmailMessage came to recognize and support Header objects, then Python programmers under specific constraints regarding what encodings their customers' email clients will recognize and support would be able to hand-craft the selection of the correct encoding instead of being forced to either ASCII or UTF-8 with binary as the two predominant choices that EmailMessage makes on its own.
----------
components: email
messages: 215112
nosy: barry, brandon-rhodes, r.david.murray
priority: normal
severity: normal
status: open
title: EmailMessage should support Header objects
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21095>
_______________________________________
More information about the Python-bugs-list
mailing list