diff options
| author | fukachan <fukachan> | 2001-11-03 11:53:03 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-11-03 11:53:03 +0000 |
| commit | 8e7ef153e831490aac271406aef7e955f0ebc249 (patch) | |
| tree | 9b6fc6c6172a8666c69b1d75856e13e9c8d2b925 /fml/lib/Mail/ThreadTrack | |
| parent | 8f56aef14e4391f85e10592af7d46a4fcb2a94f3 (diff) | |
| download | fml8-8e7ef153e831490aac271406aef7e955f0ebc249.tar.gz fml8-8e7ef153e831490aac271406aef7e955f0ebc249.tar.bz2 fml8-8e7ef153e831490aac271406aef7e955f0ebc249.zip | |
build-in decode_mime_string()
Diffstat (limited to 'fml/lib/Mail/ThreadTrack')
| -rw-r--r-- | fml/lib/Mail/ThreadTrack/Print.pm | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/fml/lib/Mail/ThreadTrack/Print.pm b/fml/lib/Mail/ThreadTrack/Print.pm index 88f94de6..c7a57bb3 100644 --- a/fml/lib/Mail/ThreadTrack/Print.pm +++ b/fml/lib/Mail/ThreadTrack/Print.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Print.pm,v 1.3 2001/11/03 00:18:02 fukachan Exp $ +# $FML: Print.pm,v 1.4 2001/11/03 01:22:14 fukachan Exp $ # package Mail::ThreadTrack::Print; @@ -273,7 +273,6 @@ sub _header_summary my $subject = $args->{ header }->get('subject'); my $padding = $args->{ padding }; - use FML::MIME qw(decode_mime_string); $subject = decode_mime_string($subject, { charset => 'euc-japan' }); $subject =~ s/\n/ /g; $subject = _delete_subject_tag_like_string($subject); @@ -292,6 +291,40 @@ sub _header_summary } +=head2 C<decode_mime_string(string, [$options])> + +decode a base64/quoted-printable encoded string to a plain message. +The encoding method is automatically detected. + +C<$options> is a HASH REFERENCE. +You can specify the charset of the string to return +by $options->{ charset }. + +=cut + +sub decode_mime_string +{ + my ($str, $options) = @_; + my $charset = $options->{ 'charset' } || 'euc-japan'; + + if ($charset eq 'euc-japan') { + use MIME::Base64; + if ($str =~ /=\?ISO\-2022\-JP\?B\?(\S+\=*)\?=/i) { + $str =~ s/=\?ISO\-2022\-JP\?B\?(\S+\=*)\?=/decode_base64($1)/gie; + } + + use MIME::QuotedPrint; + if ($str =~ /=\?ISO\-2022\-JP\?Q\?(\S+\=*)\?=/i) { + $str =~ s/=\?ISO\-2022\-JP\?Q\?(\S+\=*)\?=/decode_qp($1)/gie; + } + } + + use Jcode; + &Jcode::convert(\$str, 'euc'); + $str; +} + + sub STR2EUC { my ($str) = @_; |
