BLIND-HAMS Archives

For blind ham radio operators

BLIND-HAMS@LISTSERV.ICORS.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ron Canazzi <[log in to unmask]>
Reply To:
For blind ham radio operators <[log in to unmask]>
Date:
Fri, 19 Aug 2011 09:08:44 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (91 lines)
Hi Joseph,

If you are using Linux with Orca--which judging by your post I think you may 
be, with the accessible version of Linux called Vinux, people are using 
Evolution Mail--a Windows-like full featured mail client, which you can 
configure to display messages in plain text only--just as you can with 
Windows based clients like Windows Live Mail and Outlook.

While I'm sure your method works, anyone reading this would have to know a 
lot about python scripting and other Linux based coding--which I dare say 
most people on this list have no idea of.


----- Original Message ----- 
From: "T. Joseph Carter" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Friday, August 19, 2011 2:26 AM
Subject: Quoted-printable crap on messages


Alas, it is 2011, and Quoted-Unreadable is not yet dead!

Messages from this list are encoded in it if they contain even the
slightest non-ASCII character or long line.  Only, it doesn't put a
header on the message telling modern clients to do the decoding
automatically.

Fortunately, I use a text-based client called mutt, which allows all
kinds of folder and other kinds of hooks.  I do not know if anybody
else can benefit from this but I offer it in case it might be useful
to someone:

In my .muttrc:

folder-hook . 'unset display_filter'
folder-hook '+Gmail/ham\.blind-hams' \
'set display_filter="~/Library/bin/quoted-unreadable"'


For any folder, the first line un-sets the display_filter option.
Without this, all messages would be assumed to be in quoted-printable
format and thus decoded.  We don't want that, since it is only this
list that uses QP without telling the client about it!

The second line (and third via continuation backslash) matches on the
precise name of the folder "Gmail/ham.blind-hams" located in my mail
directory.  It then sets the display filter for this list alone to be
the script named quoted-unreadable in ~/Library/bin (which kind of
mixes the UNIX and Mac paradigms a little, but I couldn't think of a
better name for a bin directory than, well, bin.)

Anyway, here's the script, written using Python:

#! /usr/bin/env python

import sys
import quopri

# Mutt sends displayed headers through this hook, ignore them!
show_header = True
while show_header:
hdr_line = sys.stdin.readline()
sys.stdout.write(hdr_line)
if len(hdr_line.rstrip('\r\n')) == 0:
show_header = False

# The entire body of the message is filtered with a single line:
quopri.decode(sys.stdin, sys.stdout)


Yup, that's it.  The heavy lifting is done by quopri, which is
apparently something you probably already have installed if you've
got a full Python library.

If you can filter the body alone, you need just the two import lines
and the call to quopri.decode.

I haven't the faintest idea how you'll use this on anything other
than Mutt, and yes I know the way I handle headers could be improved.
Much could be done if I were to make the header handling optional, so
that I could make effective use of this one-line-wonder elsewhere
(because for example I have seen on this list the occasional
double-QP which my filter makes no attempt to solve.  But there you
have it.

It finally got annoying, so I fixed it on my end.  It's taken longer
to share the result than it did to fix the problem and test it, so I
hope it's useful to somebody.  *grin*

Joseph - KF7QZC

ATOM RSS1 RSS2