T. Joseph CARTER wrote:
> So the question is, how do I match on the condition of that two-line
> breakage and, having done so, how do I fix the broken charset before
> writing the message to the destination folder?
>
> Content-type: text/plain; charset="US-ASCII"
> Content-Transfer-Encoding: quoted-printable
Use the "f" flag to filter your mail through an external program
that handles multiline regexps.
:0fw
* ^X-Mailer:.* for Windows
* ^Content-type: text/plain; charset="US-ASCII"
* ^Content-Transfer-Encoding: quoted-printable
# Smells like AOL -- fix the charset.
| python fix_aol_charset.py
# Resume processing here...
fix_aol_charset.py looks like this.
#!/usr/bin/python
import re, sys
pattern = r'(content-type:\s*text/plain;\scharset=")us-ascii("\n'
pattern += r'content-transfer-encoding: quoted-printable)'
pattern = re.compile(pattern, re.IGNORECASE | re.MULTILINE)
fix = lambda msg: pattern.sub(r'\1windows-1252\2', msg)
sys.stdout.write(fix(sys.stdin.read()))
The three condition lines in .procmailrc are an optimization to invoke
the external program only on messages that *probably* have the charset
problem. Feel free to give them more forgiving regexps -- I just
copied the text from your mail.
--
Bob Miller K<bob>
[EMAIL PROTECTED]
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug