[issue4958] email/header.py ecre regular expression issue

Gabriel Genellina report at bugs.python.org
Fri Jan 16 08:32:08 CET 2009


Gabriel Genellina <gagsl-py2 at yahoo.com.ar> added the comment:

Your example header is invalid. Excerpt from RFC2047 <http://
www.ietf.org/rfc/rfc2047.txt> section 5:

   + An 'encoded-word' MUST NOT be used in parameter of a MIME
     Content-Type or Content-Disposition field, or in any structured
     field body except within a 'comment' or 'phrase'.

Even in the places where an "encoded word" (the sequence =?...?=) is 
allowed, it must always be surrounded by whitespace -- this is by 
design in the RFC.

If you have many of those invalid headers, you'll have to "cook" the 
output of decode_header, posibly detecting malformed sequences and 
calling decode_header again with just the offending substring. 

I don't think that Python should accept malformed headers - but if you 
come to a good solution you may publish the recipe in the Python 
cookbook <http://www.activestate.com/ASPN/Python/Cookbook/>

I'd close this report as invalid.

----------
nosy: +gagenellina

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


More information about the Python-bugs-list mailing list