[Bug 1060951] Re: Bug getting i18n'ed attachment filenames (RFC2231)
Mark Sapiro
mark at msapiro.net
Wed Oct 3 17:56:06 CEST 2012
This works for me with Mailman 2.1.15 and email 4.0.1. Does it fail for
you with Mailman 2.1.x? If so, what Mailman and email versions?
[msapiro at MSAPIRO ~]$ python
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import email
>>> email.__version__
'4.0.1'
>>> import sys
>>> sys.path.insert('/cygdrive/f/test-mailman/')
>>> from Mailman import Message
>>> msg = email.message_from_string("""Message-ID: <blah at example.com>
... Content-Type: multipart/mixed; boundary="------------050607040206050605060208"
...
... This is a multi-part message in MIME format.
... --------------050607040206050605060208
... Content-Type: text/plain; charset=UTF-8
... Content-Transfer-Encoding: quoted-printable
...
... Test message containing an attachment with an accented filename
...
... --------------050607040206050605060208
... Content-Type: text/plain; charset=UTF-8;
... name="=?UTF-8?B?dG9kby1kw6lqZXVuZXIudHh0?="
... Content-Transfer-Encoding: base64
... Content-Disposition: attachment;
... filename*=UTF-8''%74%6F%64%6F%2D%64%C3%A9%6A%65%75%6E%65%72%2E%74%78%74
...
... VmlhbmRlCk1lbnRoZQpQYWluClZpbgoKQ3Vpc2luZTogcHLDqXBhcmVyIGwnYXDDqXJvLCBj
... b3VwZXIgZXQgZmFpcmUgcmlzc29sZXIgbGVzIHBhdGF0ZXMsIGV0IGZhaXJlIGxlcyBjb29r
... aWVzCg==
... --------------050607040206050605060208--
... """, Message.Message)
>>> msg
>From nobody Wed Oct 3 08:43:13 2012
Message-ID: <blah at example.com>
Content-Type: multipart/mixed; boundary="------------050607040206050605060208"
This is a multi-part message in MIME format.
--------------050607040206050605060208
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Test message containing an attachment with an accented filename
--------------050607040206050605060208
Content-Type: text/plain; charset=UTF-8;
name="=?UTF-8?B?dG9kby1kw6lqZXVuZXIudHh0?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename*=UTF-8''%74%6F%64%6F%2D%64%C3%A9%6A%65%75%6E%65%72%2E%74%78%74
VmlhbmRlCk1lbnRoZQpQYWluClZpbgoKQ3Vpc2luZTogcHLDqXBhcmVyIGwnYXDDqXJvLCBj
b3VwZXIgZXQgZmFpcmUgcmlzc29sZXIgbGVzIHBhdGF0ZXMsIGV0IGZhaXJlIGxlcyBjb29r
aWVzCg==
--------------050607040206050605060208--
>>> att = msg.get_payload()[1]
>>> att
>From nobody Wed Oct 3 08:43:44 2012
Content-Type: text/plain; charset=UTF-8;
name="=?UTF-8?B?dG9kby1kw6lqZXVuZXIudHh0?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename*=UTF-8''%74%6F%64%6F%2D%64%C3%A9%6A%65%75%6E%65%72%2E%74%78%74
VmlhbmRlCk1lbnRoZQpQYWluClZpbgoKQ3Vpc2luZTogcHLDqXBhcmVyIGwnYXDDqXJvLCBj
b3VwZXIgZXQgZmFpcmUgcmlzc29sZXIgbGVzIHBhdGF0ZXMsIGV0IGZhaXJlIGxlcyBjb29r
aWVzCg==
>>> att.get_filename()
u'todo-d\xe9jeuner.txt'
** Changed in: mailman/2.1
Importance: Undecided => Medium
** Changed in: mailman/2.1
Status: New => Incomplete
** Changed in: mailman/2.1
Assignee: (unassigned) => Mark Sapiro (msapiro)
--
You received this bug notification because you are a member of Mailman
Coders, which is subscribed to GNU Mailman.
https://bugs.launchpad.net/bugs/1060951
Title:
Bug getting i18n'ed attachment filenames (RFC2231)
To manage notifications about this bug go to:
https://bugs.launchpad.net/mailman/+bug/1060951/+subscriptions
More information about the Mailman-coders
mailing list