procmail
[Top] [All Lists]

Re: Charset ISO-8859-1 and ASCII Subjects

2004-03-10 15:01:20
On Wed, 10 Mar 2004, Felipe Piccirilo wrote:

FP>
FP> So I have the case
FP>
FP> ( * ^Subject:.*Milhões pra cáça ) is different ( *
FP> ^Subject:.*=?iso-8859-1?B?TWlsaPVlcyBwcmEgY+HnYQ==?=)
FP>
FP>
FP> Resuming, Is there any way to procmail decode the subject iso-8859-1
FP> and match my rule?
FP>


First identify if it is a base 64 header, then store the decoded header in
a variable. Finally, test the contents of the variable.  I have a recipe
that starts as follows:


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

  # 5% gagabuggee subject
  :0 D
  * -1^1 MIMESUBJECT ?? .
  *  2^1 MIMESUBJECT ?? =[0-9A-F][0-9A-F]



You would need to put in a condition to check the iso-8859-1.  I have a
recipe that does something similar:

# Mime header extension in subject
:0
* ^Subject: =\?(gb2312|big5|ks_c_5601|2022-kr|euc-kr).*\?=
{



So adding them together, you get a recipe:

:0
* ^Subject:.*=\?.*\?b\?\/.+\?=
* ^Subject: =\?iso-8859-1.*\?=
{
  MIMESUBJECT=`echo $MATCH | mimencode -u -b`

  :0
  * MIMESUBJECT ?? ^Subject:.*Milhões pra cáça
  /dev/null
}

Note that that recipe is untested.

-- 
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. A
  password autoresponder may be invoked if this email is very old. )



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail