Re: Printing UTF-8 mail to terminal

2024-11-02 Thread Jon Ribbens via Python-list
On 2024-11-01, Eli the Bearded <*@eli.users.panix.com> wrote:
> In comp.lang.python, Gilmeh Serda   wrote:
>> Python 3.12.6 (main, Sep  8 2024, 13:18:56) [GCC 14.2.1 20240805] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> help('modules')
>> 
>> Please wait a moment while I gather a list of all available modules...
>> 
>> AssemblyApp apparmorio  pyzipper
>> AssemblyGui appdirs ipaddress   qrtools
>> CAMSimulatorapplication_utility isodate queue
>> Cheetah apprise isort   quopri
>> [...]
>> """
>> 
>> Put it in a list, unmangle it, sort it and you should have an alphabetical 
>> list of all modules on your system.
>
> As someone who has done a lot of work with email in other languages,
> "quopri" is not a name I'd expect or look for first pass for dealing
> with MIME quoted-printable encoding. (Me, being me, I'd probably just
> write it for myself if I didn't quickly find it while working with
> email.)

Python went through a period of time where lots of things just got stuck
in the standard library without any particula taxonomy. Hence ending up
with base64, binascii, binhex, quopri, and uu all being separate
top-level modules, only some of which got tidied up in Python 3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Printing UTF-8 mail to terminal

2024-11-02 Thread Eli the Bearded via Python-list
In comp.lang.python, Gilmeh Serda   wrote:
> Python 3.12.6 (main, Sep  8 2024, 13:18:56) [GCC 14.2.1 20240805] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> help('modules')
> 
> Please wait a moment while I gather a list of all available modules...
> 
> AssemblyApp apparmorio  pyzipper
> AssemblyGui appdirs ipaddress   qrtools
> CAMSimulatorapplication_utility isodate queue
> Cheetah apprise isort   quopri
> [...]
> """
> 
> Put it in a list, unmangle it, sort it and you should have an alphabetical 
> list of all modules on your system.

As someone who has done a lot of work with email in other languages,
"quopri" is not a name I'd expect or look for first pass for dealing
with MIME quoted-printable encoding. (Me, being me, I'd probably just
write it for myself if I didn't quickly find it while working with
email.)

Elijah
--
MIME: multipurpose Internet mail extensions
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Printing UTF-8 mail to terminal

2024-11-02 Thread Inada Naoki via Python-list
Try PYTHONUTF8=1 envver.

2024年11月2日(土) 0:36 Loris Bennett via Python-list :

> Left Right  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
> >  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
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Printing UTF-8 mail to terminal

2024-11-02 Thread Barry via Python-list



> On 1 Nov 2024, at 22:57, Left Right  wrote:
> 
> Does this Windows Terminal support the use
> of programs like tmux?

I have not tried, but should work.

Best to install the terminal app from the MS app store.
Most use I make is to ssh into linux systems and stuff like editors.
Colour output and cursor movement all work.

 Barry

-- 
https://mail.python.org/mailman/listinfo/python-list