Deutsch English Français Italiano |
<mailman.75.1730603335.4695.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!news2.arglkargh.de!news.karotte.org!fu-berlin.de!uni-berlin.de!not-for-mail From: Inada Naoki <songofacandy@gmail.com> Newsgroups: comp.lang.python Subject: Re: Printing UTF-8 mail to terminal Date: Sun, 3 Nov 2024 12:08:41 +0900 Lines: 86 Message-ID: <mailman.75.1730603335.4695.python-list@python.org> References: <878qu49tii.fsf@zedat.fu-berlin.de> <CAJQBtgmwNbjYNr-LWYCia-9+CoRzaLj22YxzyP_EhwSspRD8_g@mail.gmail.com> <mailman.61.1730392745.4695.python-list@python.org> <87v7x7o37z.fsf@zedat.fu-berlin.de> <CAEfz+Ty9LNyHWzouvxxSxmtjQJ=zGhBWBxq3NdH=bJLACBpmBg@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 u/HO0jSrGa7fVFUh4jl+kw2NMW2rF6TVr9DeMkKMsl2w== Cancel-Lock: sha1:pfUJ1pOkz6slXm16KGqblwJhN0o= sha256:N8hXZGdqa5waSLgw7oqnbT17gawS9zxDC6gdKwd9h80= Return-Path: <songofacandy@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=D42OhfyA; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.000 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; 'debian': 0.09; 'locally': 0.09; 'terminal': 0.09; 'writes:': 0.09; 'cheers,': 0.11; '>': 0.14; 'url:listinfo': 0.15; '>>\xc2\xa0': 0.16; 'believe,': 0.16; 'bennett': 0.16; 'bits': 0.16; 'cc:name:python': 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; 'tmux': 0.16; 'which,': 0.16; 'windows.': 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; 'email addr:python.org>': 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; 'berlin': 0.35; 'skip:2 20': 0.35; '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; 'try': 0.40; 'family': 0.60; 'physical': 0.60; 'remember': 0.61; "there's": 0.61; 'skip:\xc2 10': 0.62; '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; 'right': 0.68; 'and,': 0.69; 'ist': 0.69; 'signature': 0.76; 'dr.': 0.77; 'client': 0.82; 'left': 0.83; 'email name:<python-list': 0.84; '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=1730603333; x=1731208133; darn=python.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Jiza1H9X8omr+8tPi2l1eXE/Uwbg0ZOeshgaLarlt8A=; b=D42OhfyAZ31y/zFdrxDsNOjOgzD2ztrbNEWJeem+j/R0rU3cUBavH0RrFeqQMo5AjY qF3mtFzMC+Sg2sHs9TAZJHFRtznFBam26XUP5yPAVtvgTHIHmgfpAL4k5TyGztdcZuom 81fxHpwjIrKiz3qnxn5yqgFqhXuqw+oYnreu6VlJ+huJWxlG2HM6uDOvupekMRRmdp9o VstUTWtRaMXrcg3A6qyPrHRjm16HVbdSSOGCXXBjf7Mc4Mezpks0m5QFeMjQiATjnqzy xGYeGqjMLgw9U99qjWlVs0k/7nz0cKAiia9ttb/P4PU2GUK71XSclz3nFKO/IUmaj+Gb GOJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730603333; x=1731208133; h=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=Jiza1H9X8omr+8tPi2l1eXE/Uwbg0ZOeshgaLarlt8A=; b=BVE0cWmfS6D+mk6C1vdsLzTEJ/BEE1IfZPrB6vVRYI4hHO64BCbj08L67q7mUjKBBd v4E8JaZ4kY02EgcggJi+C/e4DOUF/ldoJs0MXDKXj+8UQb88JXKQNU0XbLn413H42UiP 4kbStoAM3tEgQCXB0NsuxNB/oJByQ8TvpPoJgGW4uJPHC2DOfz0tA3PYtq7b7D4z+3CX nkW1sno0t/CZcivt2hH2Rk1Oft6PZ31FEZGRJc/YM8NjFFZutFnluBomkqiSFZowGmVl Qcsl3ZY1loSlqMdCnK4sSIMw8LRgt+jzza6aUxzxM5OyHzXYzvJAF860AnXfuKLmAMkX bgSQ== X-Gm-Message-State: AOJu0Yx7h4CG0/VfW4D2sKyoB21ihCKkHerGjghGFW80ijHNKqUud7an vzCMTR9W1xXh3xUY6jy/C616x4t8w3IgUuNiXHpkFLlIKEYQjLPdbdIcm+3Aoc0hZdr/8fX8Fyk F80eWC517G7+5ZgRbk1LmOdPiMQg= X-Google-Smtp-Source: AGHT+IFHI+6KNMH8DS1L/kITbNh7eGsOKYRo+Qn4QCny6YsPamOLw4i/lruHiGSZjEvzfZRotHRfmun5obhqXTgPUCs= X-Received: by 2002:ac8:59c5:0:b0:461:263e:6939 with SMTP id d75a77b69052e-461717c654cmr208010311cf.49.1730603332819; Sat, 02 Nov 2024 20:08:52 -0700 (PDT) In-Reply-To: <87v7x7o37z.fsf@zedat.fu-berlin.de> X-Content-Filtered-By: Mailman/MimeDel 2.1.39 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: <CAEfz+Ty9LNyHWzouvxxSxmtjQJ=zGhBWBxq3NdH=bJLACBpmBg@mail.gmail.com> X-Mailman-Original-References: <878qu49tii.fsf@zedat.fu-berlin.de> <CAJQBtgmwNbjYNr-LWYCia-9+CoRzaLj22YxzyP_EhwSspRD8_g@mail.gmail.com> <mailman.61.1730392745.4695.python-list@python.org> <87v7x7o37z.fsf@zedat.fu-berlin.de> Bytes: 9304 Try PYTHONUTF8=3D1 envver. 2024=E5=B9=B411=E6=9C=882=E6=97=A5(=E5=9C=9F) 0:36 Loris Bennett via Python= -list <python-list@python.org>: > Left Right <olegsivokon@gmail.com> writes: > > > 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-window= s-console-to-utf-8 > > , which, I believe, will solve your problem with how the text is > > displayed. > > I'm not using MS Windows. I am using a Gnome terminal on Debian 12 > locally and connecting via SSH to a AlmaLinux 8 server, where I start a > tmux session. > > > 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 a= nd > >> 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 o= f > >> a similar program. As far as I recall there was an issue with fact th= e > >> 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 > -- > Dr. Loris Bennett (Herr/Mr) > FUB-IT, Freie Universit=C3=A4t Berlin > -- > https://mail.python.org/mailman/listinfo/python-list >