Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #196939
| From | Cameron Simpson <cs@cskk.id.au> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Printing UTF-8 mail to terminal |
| Date | 2024-11-02 08:47 +1100 |
| Message-ID | <mailman.69.1730497664.4695.python-list@python.org> (permalink) |
| References | <875xp7nwus.fsf@zedat.fu-berlin.de> <ZyVMe3Jspc0fJrel@cskk.homeip.net> |
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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Printing UTF-8 mail to terminal "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-10-31 16:33 +0100
Re: Printing UTF-8 mail to terminal Left Right <olegsivokon@gmail.com> - 2024-10-31 17:38 +0100
Re: Printing UTF-8 mail to terminal "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-11-01 07:52 +0100
Re: Printing UTF-8 mail to terminal Inada Naoki <songofacandy@gmail.com> - 2024-11-03 12:08 +0900
Re: Printing UTF-8 mail to terminal "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-11-04 11:48 +0100
Re: Printing UTF-8 mail to terminal (Posting On Python-List Prohibited) Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-10-31 19:35 +0000
Re: Printing UTF-8 mail to terminal Cameron Simpson <cs@cskk.id.au> - 2024-11-01 07:50 +1100
Re: Printing UTF-8 mail to terminal "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-11-01 08:11 +0100
Re: Printing UTF-8 mail to terminal "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-11-01 10:10 +0100
Re: Printing UTF-8 mail to terminal dieter.maurer@online.de - 2024-11-01 17:38 +0100
Re: Printing UTF-8 mail to terminal Cameron Simpson <cs@cskk.id.au> - 2024-11-02 08:47 +1100
Re: Printing UTF-8 mail to terminal "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-11-04 11:44 +0100
Re: Printing UTF-8 mail to terminal "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-11-04 11:57 +0100
Re: Printing UTF-8 mail to terminal "Loris Bennett" <loris.bennett@fu-berlin.de> - 2024-11-04 13:02 +0100
Re: Printing UTF-8 mail to terminal "Peter J. Holzer" <hjp-python@hjp.at> - 2024-11-05 21:39 +0100
Re: Printing UTF-8 mail to terminal Cameron Simpson <cs@cskk.id.au> - 2024-11-06 08:20 +1100
Re: Printing UTF-8 mail to terminal Cameron Simpson <cs@cskk.id.au> - 2024-11-02 08:44 +1100
csiph-web