#!/usr/bin/perl -w use MIME::Words qw/decode_mimewords/; use Text::Iconv; use I18N::Langinfo qw(langinfo CODESET); my $localcharset = langinfo(CODESET()); while(<>) { my @text; foreach $pair (decode_mimewords($_)) { my ($text, $charset) = @$pair; unless($charset) { push @text, $text; next; } my $converter = Text::Iconv->new($charset, $localcharset); push @text, $converter->convert($text); } print @text; }