Форум сайта python.su
Как получить имя файла из заголовка MIME?
Content-Disposition: attachment; filename=“=?koi8r?Q?=F0=D2=C5=DA=C5=CE=D4=C1=C3=C9=D1_=FE=C5=D2=CE=CF=CD=CF=D2=D3=CB=CF=CA_=EB=CF.rar?=”
mimetools.Message(src, src.seekable).getparam(“name”) дает недекодированное имя файла
Офлайн
Так декодируйте его :/
Там же есть
decode( input, output, encoding)Насколько я понимаю их можно использовать для того чтобы получить сообщение в нужной кодировке.
Read data encoded using the allowed MIME encoding from open file object input and write the decoded data to open file object output. Valid values for encoding include ‘base64’, ‘quoted-printable’, ‘uuencode’, ‘x-uuencode’, ‘uue’, ‘x-uue’, ‘7bit’, and ‘8bit’. Decoding messages encoded in ‘7bit’ or ‘8bit’ has no effect. The input is simply copied to the output.
encode( input, output, encoding)
Read data from open file object input and write it encoded using the allowed MIME encoding to open file object output. Valid values for encoding are the same as for decode().
Офлайн