Procmail and Mutt and non-ascii characters

Simon Wistow simon at thegestalt.org
Wed Apr 19 12:14:07 BST 2006


So, I have a problem. I read my mail via mutt over a remote link. 
Recently non ascii characters have started to become a problem in that 
they corrupt the display and more than once I've accidentally deleted 
the wrong mail.

So I found a recipe from our own Pete Sergeant that does this

  # Rewrite the subject and sender to remove foreign characters
  OLDSUBJECT=`/usr/bin/formail -xSubject:`
  NEWSUBJECT=`echo $OLDSUBJECT | /usr/bin/tr -cs '\11\12\40-\176' 'Z'`

  OLDSENDER=`/usr/bin/formail -xFrom:`
  NEWSENDER=`echo $OLDSENDER | /usr/bin/tr -cs '\11\12\40-\176' 'Z'`

  :0fw
  |/usr/bin/formail -i "Subject: $NEWSUBJECT"

  :0fw
  |/usr/bin/formail -i "From: $NEWSENDER"

Figuring that the amount of non-spam, non-list mail I get with actual
bona-fide none ascii characters in the subject or from line will be so 
vanishingly small that retrieving the Old-Subject and Old-From lines 
from the headers to make the mail pristine again will be doable.

But I have a problem. It's nuking subject lines like 

	[Gamesculture] Dragon Quest

into 

	e Dragon Quest

And I have no idea why.

Give a brother monger a clue?

Simon




More information about the london.pm mailing list