Re: Printing UTF-8 mail to terminal

Liste des GroupesRevenir à cl python 
Sujet : Re: Printing UTF-8 mail to terminal
De : cs (at) *nospam* cskk.id.au (Cameron Simpson)
Groupes : comp.lang.python
Date : 01. Nov 2024, 23:47:39
Autres entêtes
Message-ID : <mailman.69.1730497664.4695.python-list@python.org>
References : 1 2
User-Agent : Mutt/2.2.13 (2024-03-09)
On 01Nov2024 10:10, Loris Bennett <loris.bennett@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.

Date Sujet#  Auteur
31 Oct 24 * Printing UTF-8 mail to terminal17Loris Bennett
31 Oct 24 +* Re: Printing UTF-8 mail to terminal4Left Right
1 Nov 24 i`* Re: Printing UTF-8 mail to terminal3Loris Bennett
3 Nov 24 i `* Re: Printing UTF-8 mail to terminal2Inada Naoki
4 Nov 24 i  `- Re: Printing UTF-8 mail to terminal1Loris Bennett
31 Oct 24 +- Re: Printing UTF-8 mail to terminal (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
31 Oct 24 `* Re: Printing UTF-8 mail to terminal11Cameron Simpson
1 Nov 24  `* Re: Printing UTF-8 mail to terminal10Loris Bennett
1 Nov 24   +* Re: Printing UTF-8 mail to terminal8Loris Bennett
1 Nov 24   i+- Re: Printing UTF-8 mail to terminal1dieter.maurer
1 Nov 24   i`* Re: Printing UTF-8 mail to terminal6Cameron Simpson
4 Nov 24   i `* Re: Printing UTF-8 mail to terminal5Loris Bennett
4 Nov 24   i  `* Re: Printing UTF-8 mail to terminal4Loris Bennett
4 Nov 24   i   `* Re: Printing UTF-8 mail to terminal3Loris Bennett
5 Nov 24   i    +- Re: Printing UTF-8 mail to terminal1Peter J. Holzer
5 Nov 24   i    `- Re: Printing UTF-8 mail to terminal1Cameron Simpson
1 Nov 24   `- Re: Printing UTF-8 mail to terminal1Cameron Simpson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal