Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #196948
| From | Inada Naoki <songofacandy@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Printing UTF-8 mail to terminal |
| Date | 2024-11-03 12:08 +0900 |
| Message-ID | <mailman.75.1730603335.4695.python-list@python.org> (permalink) |
| 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> |
Try PYTHONUTF8=1 envver. 2024年11月2日(土) 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-windows-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 PM 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: Ü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. > >> -- > >> https://mail.python.org/mailman/listinfo/python-list > -- > Dr. Loris Bennett (Herr/Mr) > FUB-IT, Freie Universität Berlin > -- > https://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
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