[Mailman-Users] Archive line contains unsightly iso-8899-1 text

Kevin McCann kmccann at bellanet.org
Thu Mar 8 15:57:06 CET 2001


At 12:02 AM 2001/03/08 -0600, gary pickens wrote:
>Hello,
>
>On some of my archive lists I am getting the following text:
>
>  =?iso-8859-1?Q?Enrique_De_La_Pe=F1a_and_Jos=E9_Urrea's_Diaries?=

Hi Gary,

Accented characters in the Subject and From: headers get MIME-encoded. If 
you see ?Q?, it's quoted-printable encoding while ?B? indicates base64 
encoding. Either way, you need to decode. List archive tools such as 
Mhonarc handle this. The following script is an example of how to decode 
the Subject: using Perl. Perhaps the Mailman volunteer coders can work the 
same kind of thing (a la Python) into the next major release.

---------------------------------------------------------------------------------
#! /usr/bin/perl
use MIME::Base64 ();
use MIME::QuotedPrint();

if (defined($fields{'subject'}) and $fields{'subject'} =~ /\S/) {
($sub = $fields{'subject'}) =~ s/\s+$//;
$sub = subject_strip($sub)  if $SubStripCode;
## Multiline Base64 encoded Subject
my @encoded;
my $line;
if($sub =~ /=\?[A-Za-z0-9\-]*\?[Bb]\?[A-Za-z0-9+\/=]*\?=/ ){
     @encoded = (split(/\?=/, $sub));
     $sub = "";
     for($line = 0; $line < scalar(@encoded); $line++){
         $sub .= MIME::Base64::decode((split(/\?/,$encoded[$line]))[3]);
     }
}
## Multiline QuotedPrintable encoded Subject
if($sub =~ /=\?[A-Za-z0-9\-]*\?[Qq]\?[:ascii:]*\?=/){
     @encoded = (split(/\?=/, $sub));
     $sub = "";
     for($line = 0; $line <scalar(@encoded); $line++){
         $sub .= MIME::Base64::decode((split(/\?/,$encoded[$line]))[3]);
     }
}
} else {
$sub = 'No Subject';
}
-----------------------------------------------------

Cheers,
Kevin






More information about the Mailman-Users mailing list