Nando writes:

 > I have a second suggestion to that same Message.get_filename() method.
 > 
 > It needs to understand filenames that come with text encodings.

It does, already, by use of .collapse_rfc2231_value.  That uses RFC
2231 however, not RFC 2047, as you propose.  Use of RFC 2047 encodings
in parameters is specifically forbidden by that standard.

 > +        # nando: Some messages specify the file name of attachment this way:
 >          if filename is missing:
 > +            filename = self.get_param('name', missing, 'content-type')
 > +        if filename is missing:
 >              return failobj
 > +        """The following line takes care of cases such as this:
 > +Content-Disposition: attachment;
 > +  filename="=?ISO-8859-1?Q?z=C7D-_Zoltan=5Fchunk=5F5.wmv?="
 > +        """
 > +        filename = decode_header(filename)[0][0]
 >          return utils.collapse_rfc2231_value(filename).strip()

I feel your pain; Japanese MUAs do this kind of thing all the time,
too.  However, decoding such garbage should not be done without
specific permission from a human user, because it's forbidden by the
standard.
_______________________________________________
Email-SIG mailing list
[email protected]
Your options: 
http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com

Reply via email to