- Package:
- libpython3.9-stdlib
- Source:
- python3.9
- Description:
- Interactive high-level object-oriented language (standard library, version 3.9)
- Submitter:
- Thorsten Glaser
- Date:
- 2026-06-02 22:59:02 UTC
- Severity:
- normal
- Tags:
Consider this:
tglase@tglase:~ $ cat x.py3
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:~ $ python3 x.py3
pöstal 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 3.4 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:
pöstal foo bar baz foo bar baz foo bar baz foo bar baz foo
Subject: =?iso-8859-1?q?p=F6stal_foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz_foo?=
“Double embarassing” because even Python 2.7 got that one
not as catastrophically wrong.
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).
Related bugs in: libpython2.7-stdlib, perl
Dear submitter, as the package python3.4 has just been removed from the Debian archive unstable we hereby close the associated bug reports. We are sorry that we couldn't deal with your issue properly. For details on the removal, please see https://bugs.debian.org/827366 The version of this package that was in Debian prior to this removal can still be found using http://snapshot.debian.org/. This message was generated automatically; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org. Debian distribution maintenance software pp. Scott Kitterman (the ftpmaster behind the curtain)
retitle 787511 libpython3.9-stdlib: double embarassing failure in RFC2047 eMail header encoding
found 787511 3.9.10-2
tags 787511 + bookworm sid
thanks
The bug’s also still pertinent in bullseye, see previous message,
as well as sid:
(sid-amd64)tglase@tglase:~ $ python3 x.py3
pöstal 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?=
[service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit unterschiedlichen
Subject: =?utf-8?q?=5Bservice-Aufgaben_S=26W-Team=5D=5B=2319415=5D_VM=27=27s_aufsetzen_mit_unterschiedlichen?=
(sid-amd64)tglase@tglase:~ $ cat x.py3
from email.message import Message
from email.header import Header
def testit(text, encoding):
msg = Message()
h = Header(text, encoding)
msg['Subject'] = h
print(h)
print(msg.as_string())
testit('p\xf6stal foo bar baz foo bar baz foo bar baz foo bar baz', 'iso-8859-1')
testit("[service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit unterschiedlichen", 'UTF-8')
It apparently was, *ahem*, “forgotten” because the name of the package
changed and the bug was not carried over to the new name…
Incidentally, no, reporting bugs regarding encoding issues upstream is
n̲o̲t̲ easily possible, because upstream’s bugtracker errors out with
encoding errors if trying that… see https://bugs.python.org/issue46701
(encoding in Python and py3k both is a neverending joke…)
bye,
//mirabilos
Dear submitter, as the package python3.9 has just been removed from the Debian archive unstable we hereby close the associated bug reports. We are sorry that we couldn't deal with your issue properly. For details on the removal, please see https://bugs.debian.org/1028419 The version of this package that was in Debian prior to this removal can still be found using https://snapshot.debian.org/. Please note that the changes have been done on the master archive and will not propagate to any mirrors until the next dinstall run at the earliest. This message was generated automatically; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org. Debian distribution maintenance software pp. Scott Kitterman (the ftpmaster behind the curtain)
reopen 787511 reassign 787511 libpython3.11-stdlib found 787511 3.11.1-2 thanks This is getting annoying… bye, //mirabilos
Dear submitter, as the package python3.11 has just been removed from the Debian archive unstable we hereby close the associated bug reports. We are sorry that we couldn't deal with your issue properly. For details on the removal, please see https://bugs.debian.org/1076098 The version of this package that was in Debian prior to this removal can still be found using https://snapshot.debian.org/. Please note that the changes have been done on the master archive and will not propagate to any mirrors until the next dinstall run at the earliest. This message was generated automatically; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org. Debian distribution maintenance software pp. Scott Kitterman (the ftpmaster behind the curtain)
Dear submitter, as the package python3.12 has just been removed from the Debian archive unstable we hereby close the associated bug reports. We are sorry that we couldn't deal with your issue properly. For details on the removal, please see https://bugs.debian.org/1109333 The version of this package that was in Debian prior to this removal can still be found using https://snapshot.debian.org/. Please note that the changes have been done on the master archive and will not propagate to any mirrors until the next dinstall run at the earliest. This message was generated automatically; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org. Debian distribution maintenance software pp. Thorsten Alteholz (the ftpmaster behind the curtain)
reopen 787511
reassign 787511 libpython3.13-stdlib
found 787511 3.13.5-2
thanks
Still the same.
(pbuild9303-sid/i386)root@wirt:/# cat >x.py3
from email.message import Message
from email.header import Header
def testit(text, encoding):
msg = Message()
h = Header(text, encoding)
msg['Subject'] = h
print(h)
print(msg.as_string())
testit('p\xf6stal foo bar baz foo bar baz foo bar baz foo bar baz', 'iso-8859-1')
testit("[service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit unterschiedlichen", 'UTF-8')
(pbuild9303-sid/i386)root@wirt:/# python3 x.py3
pöstal 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?=
[service-Aufgaben S&W-Team][#19415] VM''s aufsetzen mit unterschiedlichen
Subject: =?utf-8?q?=5Bservice-Aufgaben_S=26W-Team=5D=5B=2319415=5D_VM=27=27s_aufsetzen_mit_unterschiedlichen?=
bye,
//mirabilos
Hi Thorsten (2015.06.02_08:04:56_-0400) I can't find any reference to an 82 character limit in RFC822. Also, RFC822 is ancient history. It was updated by RFC2822 in 2001 to explicitly have a line length limit of 998 characters. So, I'm not sure that there's a bug here. Stefano
Hi Stefano, too headachy to look it up again (I did look things up when I reported this) but I’ve got concrete mis-display with the overlong lines this generates in real-existing clients, and I’m sufficiently sure that some of the RFC involved does say that the MIME stuff needs to be split and wrapped sufficiently. Fixing this should not be undue burden and improves the reach of the resulting strings. bye, //mirabilos
Hi Thorsten (2026.06.02_22:45:28_+0000) I'm sorry nobody engaged with you on this bug sooner. Thanks for carrying it forward through the Python versions. I'm happy to take a bug report upstream and try to get it resolved, but I really need it to be a clearly definsible bug. My brief reading of the RFCs didn't show any obvious issue. Stefano