- 论坛徽章:
- 0
|
用net::pop3写邮件客户端,取得的邮件主题等显示乱码?
要求MIME::Base64
#!/usr/local/bin/perl -w
use Encode;
my $DECODE_FUNCS={
b=>;['Base64','base64'],
q=>;['QuotedPrint','qp']
};
sub decode_subject
{
my ($charset,$enc,$subj)=(shift()=~/\=\?(.*)\?(.)\?(.*)\?\=$/);
$enc=lc($enc);
#eval {
require encoding;
encoding->;import ($charset);
my $mod='MIME::'.$DECODE_FUNCS->;{$enc}->;[0];
eval "
require $mod;
$mod->;import;
" ;
print decode($charset,&{'decode_'.$DECODE_FUNCS->;{$enc}->;[1]}($subj)),"\n";
}
}
&decode_subject(q(=?gb2312?B?s8/R+8T6ss68086iyO0gTVNETiBXZWJjYXN0cyDW0M7EzfjC57njsqU21MIxyNW/zrPM?=));
输出 "诚邀您参加微软 MSDN Webcasts 中文网络广播6月1日课程" |
|