On 01Nov2024 10:10, Loris Bennett <loris.benn...@fu-berlin.de> wrote:
as expected.  The non-UTF-8 text occurs when I do

 mail = EmailMessage()
 mail.set_content(body, cte="quoted-printable")
 ...

 if args.verbose:
     print(mail)

which is presumably also correct.

The question is: What conversion is necessary in order to print the
EmailMessage object to the terminal, such that the quoted-printable
parts are turned (back) into UTF-8?

Do you still have access to `body` ? That would be the original message text? Otherwise maybe:

    print(mail.get_content())

The objective is to obtain the message body Unicode text (i.e. a regular Python string with the original text, unencoded). And to print that.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to