On 06/02/2015 02:04 PM, Thorsten Glaser wrote:
> Package: libpython2.7-stdlib
> Version: 2.7.10-2
> Severity: normal
> 
> Consider this:
> 
> tglase@tglase:~ $ cat x.py
> from email.message import Message
> from email.header import Header
> msg = Message()
> h = Header('p\xf6stal foo bar baz foo bar baz foo bar baz foo bar baz', 
> 'iso-8859-1')
> msg['Subject'] = h
> print h
> print msg.as_string()
> tglase@tglase:~ $ python x.py                                                 
>                              
> =?iso-8859-1?q?p=F6stal_foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz?=
> Subject: 
> =?iso-8859-1?q?p=F6stal_foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz?=
> 
> 
> tglase@tglase:~ $ cat x.php
> <?php
> $h = "Subject: p\xf6stal foo bar baz foo bar baz foo bar baz foo bar baz";
> echo mb_encode_mimeheader($h, "ISO-8859-1", "Q", "\n") . "\n";
> 
> $h = "Subject: [service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit 
> unterschiedlichen";
> echo mb_encode_mimeheader($h, "UTF-8", "Q", "\n") . "\n";
> tglase@tglase:~ $ php x.php
> Subject: =?ISO-8859-1?Q?p=3Fstal=20foo=20bar=20baz=20foo=20bar=20baz=20fo?=
>  =?ISO-8859-1?Q?o=20bar=20baz=20foo=20bar=20baz?=
> Subject: [service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit
>  unterschiedlichen
> 
> 
> See how Python 2.7 embarassingly fails this extremely simple
> RFC2047 eMail header MIME encoding test: the resulting header
> line is 82 chars, and thus longer than what RFC822 permits.
> “Embarassing” because PHP gets it all right.
> 
> If I add another ' foo' at the end, I get this:
> 
> =?iso-8859-1?q?p=F6stal_foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz_f?=
>  =?iso-8859-1?q?oo?=
> Subject: 
> =?iso-8859-1?q?p=F6stal_foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz_f?=
>  =?iso-8859-1?q?oo?=
> 
> Note how it’s still broken because the length of the actual
> header name is not taken into account where it must be, even
> though the idea to break after the 75th output octet is right.
> 
> This is bad because MUAs like Pine rightfully refuse to
> RFC2047-decode such bad and broken messages (but apparently
> widespread to an amount that Alpine as packaged in Debian  
> contains a hack to allow for such broken, overlong lines). 

please could you report this upstream, maybe with a neutral language, avoiding
"embarrasing" and "extremely simple".

Thanks, Matthias


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to