Printing UTF-8 mail to terminal
Loris Bennett
loris.bennett at fu-berlin.de
Thu Oct 31 11:33:41 EDT 2024
Hi,
I have a command-line program which creates an email containing German
umlauts. On receiving the mail, my mail client displays the subject and
body correctly:
Subject: Übung
Sehr geehrter Herr Dr. Bennett,
Dies ist eine Übung.
So far, so good. However, when I use the --verbose option to print
the mail to the terminal via
if args.verbose:
print(mail)
I get:
Subject: Übungsbetreff
Sehr geehrter Herr Dr. Bennett,
Dies ist eine =C3=9Cbung.
What do I need to do to prevent the body from getting mangled?
I seem to remember that I had issues in the past with a Perl version of
a similar program. As far as I recall there was an issue with fact the
greeting is generated by querying a server, whereas the body is being
read from a file, which lead to oddities when the two bits were
concatenated. But that might just have been a Perl thing.
Cheers,
Loris
--
This signature is currently under constuction.
More information about the Python-list
mailing list