Уведомления

Группа в Telegram: @pythonsu

#1 Май 19, 2008 19:20:07

CombatPenguin
От:
Зарегистрирован: 2008-05-19
Сообщения: 22
Репутация: +  0  -
Профиль   Отправить e-mail  

mimetools, декодирование attachment

Как получить имя файла из заголовка 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”) дает недекодированное имя файла



Офлайн

#2 Май 20, 2008 12:27:29

Ferroman
От:
Зарегистрирован: 2006-11-16
Сообщения: 2759
Репутация: +  1  -
Профиль   Отправить e-mail  

mimetools, декодирование attachment

Так декодируйте его :/
Там же есть

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().
Насколько я понимаю их можно использовать для того чтобы получить сообщение в нужной кодировке.

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version