
Hi Mark,
I've just committed my patch to this problem in 2.1 CVS branch. I used this example and looks OK for both with and without Content-Transfer-Encoding header.
Mark Sapiro wrote:
The following is a transcript of a Python interactive session that illustrates the above problems with set_payload() and get_payload(). This session is with Python 2.4.1, but exactly the same behavior occurs with 2.3.4 and 2.4.2.
Python 2.4.1 (#1, May 27 2005, 18:02:40) [GCC 3.3.3 (cygwin special)] on cygwin Type "help", "copyright", "credits" or "license" for more information.
import email
msg = email.message_from_file(open('plain2.eml'))
print msg
From nobody Mon Nov 28 09:18:41 2005 From: "Mark Sapiro" <msapiro@value.net> To: list1@localhost Subject: HTML - all Date: Sun, 27 Nov 2005 09:02:33 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"
How about just a line of stuff with some ==== and a few words.
X=91**2 (x is 91 squared)
del msg['content-type'] del msg['content-transfer-encoding'] msg.set_payload(str(msg.get_payload()), 'iso-8859-1')
print msg
From nobody Mon Nov 28 09:18:41 2005 From: "Mark Sapiro" <msapiro@value.net> To: list1@localhost Subject: HTML - all Date: Sun, 27 Nov 2005 09:02:33 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
How about just a line of stuff with some =3D=3D=3D=3D and a few words.
X=3D91**2 (x is 91 squared)
print msg.get_payload()
How about just a line of stuff with some ==== and a few words.
X=91**2 (x is 91 squared)
print msg.get_payload(decode=1)
How about just a line of stuff with some == and a few words.
X`**2 (x is 91 squared)
-- Tokio Kikuchi, tkikuchi@ is.kochi-u.ac.jp http://weather.is.kochi-u.ac.jp/