MIME::WordDecoder->default(MIME::WordDecoder->supported("UTF-8")); $subj = decode('UTF-8', unmime($subj));
Update: ug! Don't use MIME::WordDecoder. After looking at its guts, I'd recommend the snippet I presented earlier (packaged as a reusable function below). I think this toolkit predates the addition of UNICODE support to Perl. That would explain why the weird and convoluted interface.
use MIME::Words qw( decode_mimewords ); use Encode qw( decode ); sub mime_decode { my $decoded = ''; foreach (decode_mimewords($_[0])) { my ($data, $charset) = @$_; if (defined($charset)) { $decoded .= decode($charset, $data); } else { $decoded .= $data; } } return $decoded; } $subj = mime_decode($subj);
Untested
In reply to Re^3: reading Base64 encoded Unicode email returns mangled text
by ikegami
in thread reading Base64 encoded Unicode email returns mangled text
by Errto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |