Deutsch English Français Italiano |
<mailman.61.1730392745.4695.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail From: Left Right <olegsivokon@gmail.com> Newsgroups: comp.lang.python Subject: Re: Printing UTF-8 mail to terminal Date: Thu, 31 Oct 2024 17:38:50 +0100 Lines: 65 Message-ID: <mailman.61.1730392745.4695.python-list@python.org> References: <878qu49tii.fsf@zedat.fu-berlin.de> <CAJQBtgmwNbjYNr-LWYCia-9+CoRzaLj22YxzyP_EhwSspRD8_g@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de Ebr66jxUYPpgSNVqrMDQagwsuWnmELtuorhJDVkkQAtg== Cancel-Lock: sha1:EzzTALTbMKBbWgM4l7ouWWWUqqA= sha256:xABH9i9zfbEOOCd97XSBXtfTbUMBld89E1qgn70u1Lo= Return-Path: <olegsivokon@gmail.com> X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=BfNIQkxW; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'looks': 0.02; 'generated': 0.03; '31,': 0.05; 'containing': 0.05; 'windows,': 0.05; 'thing.': 0.07; 'utf-8': 0.07; 'url:mailman': 0.09; 'can,': 0.09; 'cc:addr :python-list': 0.09; 'terminal': 0.09; 'cheers,': 0.11; 'cc:no real name:2**0': 0.14; 'url:listinfo': 0.15; 'believe,': 0.16; 'bennett': 0.16; 'bits': 0.16; 'command-line': 0.16; 'dies': 0.16; 'displays': 0.16; 'encoding': 0.16; 'encoding.': 0.16; 'far,': 0.16; 'recall': 0.16; 'run,': 0.16; 'server,': 0.16; 'terminals': 0.16; 'terminology': 0.16; 'which,': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'solve': 0.19; 'uses': 0.19; 'thu,': 0.19; 'cc:addr:python.org': 0.20; 'option': 0.20; 'url- ip:188.166.95.178/32': 0.20; 'url-ip:188.166.95/24': 0.20; 'issue': 0.21; 'creates': 0.22; 'doubt': 0.22; 'version': 0.23; 'url-ip:188.166/16': 0.24; 'past': 0.25; 'cc:2**0': 0.25; 'behavior': 0.26; 'fact': 0.28; 'seem': 0.31; 'default': 0.31; 'message-id:@mail.gmail.com': 0.31; 'program': 0.32; "doesn't": 0.32; 'good.': 0.32; 'python-list': 0.32; 'but': 0.32; "i'm": 0.33; 'there': 0.33; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34; 'windows': 0.34; 'mean': 0.34; 'printing': 0.34; 'from:addr:gmail.com': 0.34; 'currently': 0.37; 'using': 0.37; 'read': 0.38; '8bit%:14': 0.38; 'use': 0.39; 'two': 0.39; "that's": 0.39; 'quite': 0.39; 'text': 0.39; 'program.': 0.40; 'family': 0.60; 'physical': 0.60; 'remember': 0.61; "there's": 0.61; 'subject': 0.63; 'similar': 0.63; 'email': 0.63; 'your': 0.64; 'german': 0.64; 'receiving': 0.66; 'lead': 0.67; 'body': 0.67; 'please,': 0.67; 'prevent': 0.67; 'site': 0.68; 'and,': 0.69; 'ist': 0.69; 'signature': 0.76; 'dr.': 0.77; 'client': 0.82; 'mail,': 0.91; 'subject:UTF': 0.91; 'skip:\xc3 10': 0.95; 'subject:mail': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730392742; x=1730997542; darn=python.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5kIsSS1zXQqwFhcELFUwtaXfK74sv+PMmAXADH4meLo=; b=BfNIQkxWkI8TCpGlJO4DXlA+gPeFR5fHyp0zmbeMq+X/k4w1Y4uf0zqqC0Ju2hB0cX LCd23W61qh1GCKmMzIddaXzTij3g8Uh4O0NWoRiXuW433S9OIaYY+N12TcVmS6AlldZ2 HgNMUkkfeFKuC2nl8DbgQmFuUkYuoGIGS2/oxOM6vZSKtu9uuPAoBQ2VVhqzsLYYFlJs efTFoMw5kgrv5RtKGRgw8X5mV8fxsGbuetdV5+2SnDT68oUaab1RlOT5gZQAndOt3gGa TwAVtbZm4RIYWQO3O2BM1i3hcWYhiISjEtupAhv4xbE+fd437RJk7XKzV5HFMNI90ygW qMJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730392742; x=1730997542; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5kIsSS1zXQqwFhcELFUwtaXfK74sv+PMmAXADH4meLo=; b=c/8eXRHyhcAxPe2xvKaASPWV7zQsOdnuq23ggdg13/ox13x4PYBxm+mWeHVx7sYgMV yDGcQqWt5myA0ejzsIbVMQPVsoQDntsdBe6XaeivLI5zJDqZDxpkQbL13shkN3J8Buaw K8vlTWUnXLLNhNB3F5npeMahTROR6Q+I4MdmfPGuA8DH3vUqVbA51y3+Y/rD8lpAanP4 A7jbokRBg7jrwjPkLUkkdz/iDMfZ9gg9nJIOalOD2HX/no/Ra4utNzJZw9y6hPzDK2ee ATSpN8+rJavFnwrSpPRBzJGMSVSOqRPfUBcVdqlalc6yc8cyhLquNbSqzzZZERMd+QNM njhw== X-Gm-Message-State: AOJu0YxUvZzWIKPfHYxJOzFbdLxdbr8bjwkSPNshSpuxop43gQctdMXD U40TFCfrgXnOJx9DXRTQ2uKuBVnDCaFrjlFAAz7njzUz64lFl2o/Q2kbjUKnLNLAQDfNliyJaTh Ri+KsrYRHyO6bBc7ezdYHMgXhX/Q= X-Google-Smtp-Source: AGHT+IFFUDMBkliaOhDXnwGkdxHiEU8VttOPFuaZlZHiQLef2sWg7nH2qPwmzs/EPdKqvAdAJ5cYctjM4jqunNjk6aA= X-Received: by 2002:ac8:5814:0:b0:461:4907:ded9 with SMTP id d75a77b69052e-461717026c3mr111858121cf.30.1730392742404; Thu, 31 Oct 2024 09:39:02 -0700 (PDT) In-Reply-To: <878qu49tii.fsf@zedat.fu-berlin.de> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: General discussion list for the Python programming language <python-list.python.org> List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> List-Archive: <https://mail.python.org/pipermail/python-list/> List-Post: <mailto:python-list@python.org> List-Help: <mailto:python-list-request@python.org?subject=help> List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> X-Mailman-Original-Message-ID: <CAJQBtgmwNbjYNr-LWYCia-9+CoRzaLj22YxzyP_EhwSspRD8_g@mail.gmail.com> X-Mailman-Original-References: <878qu49tii.fsf@zedat.fu-berlin.de> Bytes: 7914 There's quite a lot of misuse of terminology around terminal / console / shell. Please, correct me if I'm wrong, but it looks like you are printing that on MS Windows, right? MS Windows doesn't have or use terminals (that's more of a Unix-related concept). And, by "terminal" I mean terminal emulator (i.e. a program that emulates the behavior of a physical terminal). You can, of course, find some terminal programs for windows (eg. mintty), but I doubt that that's what you are dealing with. What MS Windows users usually end up using is the console. If you run, eg. cmd.exe, it will create a process that displays a graphical console. The console uses an encoding scheme to represent the text output. I believe that the default on MS Windows is to use some single-byte encoding. This answer from SE family site tells you how to set the console encoding to UTF-8 permanently: https://superuser.com/questions/269818/change-default-code-page-of-windows-= console-to-utf-8 , which, I believe, will solve your problem with how the text is displayed. On Thu, Oct 31, 2024 at 5:19=E2=80=AFPM Loris Bennett via Python-list <python-list@python.org> wrote: > > 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: =C3=9Cbung > > Sehr geehrter Herr Dr. Bennett, > > Dies ist eine =C3=9Cbung. > > 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: =C3=9Cbungsbetreff > > Sehr geehrter Herr Dr. Bennett, > > Dies ist eine =3DC3=3D9Cbung. > > 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. > -- > https://mail.python.org/mailman/listinfo/python-list