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" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> 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" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> 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/
_______________________________________________
Mailman-Developers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe:
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org
Security Policy:
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp