[New-bugs-announce] [issue7304] email.message.Message.set_payload and as_string given charset 'us-ascii' plus 8bit data produces invalid message

R. David Murray report at bugs.python.org
Tue Nov 10 23:32:48 CET 2009


New submission from R. David Murray <rdmurray at bitdance.com>:

The following produces a non-conformant message, since the us-ascii
charset is strictly 7bit:

>>> import email.message
>>> m = email.message.Message()
>>> m.set_payload("""A few lines
... of 8-bit text
...
... One high bit character: ².
... """, 'us-ascii')
>>> print m.as_string()
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 8bit

A few lines
of 8-bit text

One high bit character: ².

>>>

----------
components: Library (Lib)
messages: 95133
nosy: r.david.murray
priority: normal
severity: normal
stage: test needed
status: open
title: email.message.Message.set_payload and as_string given charset 'us-ascii' plus 8bit data produces invalid message
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7304>
_______________________________________


More information about the New-bugs-announce mailing list