On Sat, 22 Mar 1997 14:58:16 +0100 (CET),
Robin S Socha <uzs8kb(_at_)uni-bonn(_dot_)de> wrote:
First, thanks to era eriksson, the recipe now works...
Good to hear :-)
...but is there anything I can do about the [From] I get in the bozolog?
Right now, I'm getting things like:
'=?iso-8859-1?Q?Christiana_M=2E_Khalif=E9?=
This has nothing with Procmail to do. The fact is that it is
specifically prohibited to have 8-bit characters in the headers of a
message. It looks that way, really; if you see something else in your
mail reader, it's acting nice and translating this porridge for you
before displaying it.
If you really want to convert this, and other things like it, the
following snippet should do it (I hope):
:0hf
* =\?iso-8859-1\?Q\?
* any other conditions you might want ...
| perl -ne 'if (m/(.*?)=\?iso-8859-1\?Q\?(.*?)\?=(.*)/) { \
local ($r, $s, $t) = ($1, $2, $3); $s =~ s#_# #g; \
$s =~ s#=([0-9A-F]{2})# sprintf ("%c", hex ($1)) #ge; \
print "$r$s$t\n"; \
} else { print; }'
This is not very well tested and I haven't looked at the RFC while
writing this. If I weren't lazy (one of the Three Great Perl
Programmer Virtues :-) I'd probably constrain this to From: and Subject:
fields, but it shouldn't be too hard if you're at all familiar with
Perl.
Perl regex trivia: .*? is a minimally matching .*, i.e. it is not
greedy. Would be nice to have the same in Procmail, too. Parens are
magical, and correspond to $1, $2, $3 counting from the first opening
paren in the expression. (You use \( to match a literal paren.)
Bugs: If there are several similarly encoded strings in the same
header, only the first one will be converted. I think usually the
whole header is encoded if it is done at all but if there is demand, I
could try to code up a version which does multiple decodings. (I think
I've written a cleaner version before, I just don't have it here right
now.)
Which probably was:
Khalif\`e
(E9 is actually an e-acute, i.e. the accent is the other way. And 2E
is a normal period character. I'm presuming you write it this way in
order to not write 8-bit characters to the list; the accent, of
course, is really "on top of" the e.)
I couldn't get anything out of the formail man page.
Obviously. Try RFC 1522 (I think).
/* era */
--
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r. <http://www.iki.fi/~era/>
* Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>