[issue11492] email.header.Header doesn't fold headers
Scott Kitterman
report at bugs.python.org
Mon Mar 14 08:32:58 CET 2011
New submission from Scott Kitterman <sklist at kitterman.com>:
Header folding is very different (non-existent as far as I've found so far) in Python3. Here's a short example:
#!/usr/bin/python
# -*- coding: ISO-8859-1
from email.header import Header
hdrin = 'Received: from mailout00.controlledmail.com (mailout00.controlledmail.com [72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for <bcc at kitterman.com>; Sun, 13 Mar 2011 23:46:05 -0400 (EDT)'
print(Header(hdrin))
With python2.6 the output is:
Received: from mailout00.controlledmail.com (mailout00.controlledmail.com
[72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for
<bcc at kitterman.com>; Sun, 13 Mar 2011 23:46:05 -0400 (EDT)
With python3.1 or 3.2 the output is one line:
Received: from mailout00.controlledmail.com (mailout00.controlledmail.com [72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for <bcc at kitterman.com>; Sun, 13 Mar 2011 23:46:05 -0400 (EDT)
This makes it very difficult to write header processing code that works for both Python2 and Python3 even if one can fold headers at all in Python3.
----------
components: None
messages: 130793
nosy: kitterma
priority: normal
severity: normal
status: open
title: email.header.Header doesn't fold headers
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11492>
_______________________________________
More information about the Python-bugs-list
mailing list