Deutsch   English   Français   Italiano  
<878qu49tii.fsf@zedat.fu-berlin.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail
From: "Loris Bennett" <loris.bennett@fu-berlin.de>
Newsgroups: comp.lang.python
Subject: Printing UTF-8 mail to terminal
Date: Thu, 31 Oct 2024 16:33:41 +0100
Organization: FUB-IT, Freie =?utf-8?Q?Universit=C3=A4t?= Berlin
Lines: 40
Message-ID: <878qu49tii.fsf@zedat.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de h6A2QsJdNwyS4TjUPiLUdA2J5sQHgLnUlp57EntrI4k2Vo
Cancel-Lock: sha1:E6dYkpc5qJ/pmp69t7WNK60lVeM= sha1:gSIvz3wjtMauUgyRhHnU6ekDtPM= sha256:v9c2ithv//r5phiZIlGAykFBZv/VLHEMOE/zk6pieZ0=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Bytes: 1736

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.