procmail
[Top] [All Lists]

Re: decoding non-ascii subject lines

2007-11-02 19:23:28
On Fri, 2 Nov 2007, martin f krafft wrote:

mfk> Hi folks,
mfk> 
mfk> I sometimes get mail with a raw subject line like this:
mfk> 
mfk>   Subject: 
mfk> =?iso-8859-1?q?ilpostino=2Ejpberlin=2Ede_Mitgliedschafts-Erinner?=
mfk>    =?iso-8859-1?q?ung?=
mfk> 
mfk> Do you know of a good way to convert this within procmail so that
mfk> I can use filtering expressions that work on the expanded, non-ascii
mfk> text? I've had a brief look around, but short of a Python or Perl
mfk> parser, could not find any tool to do this. What do you do?
mfk> 

I don't have a solution but maybe a start towards one.

I have a recipe that starts with 

# B Mime header extension in subject?
:0 
* ^Subject:.*=\?.*\?b\?\/.+\?=
{
  MIMESUBJECT=`echo $MATCH | mimencode -u -b`


I think that if you changed the \?b\? to \?q\? and the -b to -q then 
MIMESUBJECT would have the decoded text of the first bit. You would need 
to hack off the bit after the ?= before doing this.  

Have a look at the man page for mimencode or mmencode.


-- 
Alan


( Please do not email me AS WELL as replying to the list.  Please
  address personal email to alan+1@ as lists@ is not read. )
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail