procmail
[Top] [All Lists]

Re: Dekoding eight-bit characters in headers

1997-04-21 04:33:00
On Sat, 19 Apr 1997 18:55:26 -0500,
Philip Guenther <guenther(_at_)gac(_dot_)edu> wrote:
Robin S Socha <uzs8kb(_at_)uni-bonn(_dot_)de> writes:
I seem to be one of the lucky few that never get to enjoy the interesting
recipes ;-/
<...>
Change that to:
    :0 fh
    * =\?ISO-8859-[0-9]+\?Q\?
    |perl -pe 's#=\?ISO-8859-\d+\?Q\?(.*?)\?=#$s=$1; $s=~s/\s+(\r?\n)/$1/g;' 
\
        -e '$s=~s/=\r?\n//g; $s=~s/=([\da-fA-F]{2})/pack("C", hex($1))/ge;' \
        -e '$s#ge;'

I would recommend against matching on "ISO-8859-\d+" -- if the
character set is anything other than what you are using yourself, you
will only get garbage. Wrongly decoded garbage is worse than garbage
you've left undecoded because you couldn't figure out how to decode
it, IMHO, because the encoded variant at least contains information
about how to decode it correctly. 

/* 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>

<Prev in Thread] Current Thread [Next in Thread>