This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients ajaksu2, barry, loewis, r.david.murray, tlau
Date 2010-10-03.02:16:08
SpamBayes Score 5.29514e-05
Marked as misclassified No
Message-id <1286072171.81.0.277014602652.issue1078919@psf.upfronthosting.co.za>
In-reply-to
Content
I don't believe either the example that other mailers reject or the one that they accept are in fact RFC compliant.  Encoded words are not supposed to occur in (structured) MIME headers.  The behavior observed is a consequence of all headers, whether structured or unstructured, being treated as if they were unstructured by Header.

(There's a different problem in Python3 with this example, but I'll deal with that in a separate issue.)

What we have here is primarily a documentation bug.  The way to generate the correct (RFC compliant) header is as follows:

>>> m.add_header('Content-Disposition', 'attachment',
... filename=('iso-8859-1', '', 'Fußballer_sind_klug.ppt'))
>>> str(m)
'Content-Disposition: attachment; filename*="iso-8859-1\'\'Fu%DFballer_sind_klug.ppt"\n\n'

I will add the explanation and this example to the docs.  In addition, in 3.2 I will disallow non-ASCII parameter values unless they are specified in a three element tuple as in the example above.  That will still leave some other places where structured headers are inappropriately encoded by Header (eg: addresses with non-ASCII names), but dealing with that is a somewhat deeper problem.
History
Date User Action Args
2010-10-03 02:16:12r.david.murraysetrecipients: + r.david.murray, loewis, barry, tlau, ajaksu2
2010-10-03 02:16:11r.david.murraysetmessageid: <1286072171.81.0.277014602652.issue1078919@psf.upfronthosting.co.za>
2010-10-03 02:16:09r.david.murraylinkissue1078919 messages
2010-10-03 02:16:08r.david.murraycreate