Author tanzer@swing.co.at
Recipients tanzer@swing.co.at
Date 2015-11-03.14:43:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446561810.16.0.921085816129.issue25545@psf.upfronthosting.co.za>
In-reply-to
Content
For an email message with `Content-type: text/plain; charset=utf-8`, in Python 3.5, get_payload returns a bytes object encoded with `latin-1`. Python 2.7 returns a str object encoded with `utf-8` as expected.

Running the attached test script `email_get_payload__test.py`  with Python 2.7 and 3.5 shows the difference.

Python 2.7::

    2.7.10.final.0 *** utf8 ***
    From: Christian Tanzer <tanzer@swing.co.at>
    To: Christian Tanzer <tanzer@swing.co.at>
    Content-type: text/plain; charset=utf-8


    Sehr geehrte Damen und Herren,

    ...

    Danke und mit freundlichen Grüssen,

    --
    Christian Tanzer                                    http://www.c-tanzer.at/

Python 3.5::

    3.5.0.final.0 *** latin-1 ***
    From: Christian Tanzer <tanzer@swing.co.at>
    To: Christian Tanzer <tanzer@swing.co.at>
    Content-type: text/plain; charset=utf-8


    Sehr geehrte Damen und Herren,

    ...

    Danke und mit freundlichen Grüssen,

    --
    Christian Tanzer                                    http://www.c-tanzer.at/

In both Python versions, `msg.get_content_charset()` returns None, which is not correct, either.
History
Date User Action Args
2015-11-03 14:43:30tanzer@swing.co.atsetrecipients: + tanzer@swing.co.at
2015-11-03 14:43:30tanzer@swing.co.atsetmessageid: <1446561810.16.0.921085816129.issue25545@psf.upfronthosting.co.za>
2015-11-03 14:43:30tanzer@swing.co.atlinkissue25545 messages
2015-11-03 14:43:30tanzer@swing.co.atcreate