[Email-SIG] Problem Report for email.Utils.decode_rfc2231

Mark Sapiro msapiro at value.net
Tue Jul 18 02:35:59 CEST 2006


Barry Warsaw wrote:
>
>FWIW, this is now fixed in email 4.0.1 (Python 2.5 trunk), and I will  
>be back porting the fix to email 3.0 (Python 2.4) and email 2.5  
>(Python 2.3).


I just looked at the fix in SVN, and I think there is still a problem.
I don't think the RFC 2231 encodings that produce the error are
'buggy'. There are two independent things going on in RFC 2231 - the
charset and language encoding and the splitting of the parameter into
multiple pieces, e.g. filename*0=, filename*1=, etc.

The problem with email.utils.decode_params() is it doesn't distinguish
between these cases. The charset/language information is only present
if there is a * immediately preceeding the = as in

filename*=charset'language'value

or

filename*0*=charset'language'value
...

in these cases, a compliant value must not contain '

However, if the parameter is

filename*0=value_part_0
filename*1=value_part_1
...

these value_parts may contain any number of ' characters and they don't
delimit charset and language information.

See my suggested patch attached to
<http://mail.python.org/pipermail/email-sig/2006-July/000293.html>.

-- 
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Email-SIG mailing list