- $leading_space = $1 if $string =~ s/^(\s+)//;
- # unmime calls the default MIME::WordDecoder handler set up at
- # initialization time.
- return $leading_space . MIME::WordDecoder::unmime($string);
+ $leading_space = $1 if $string =~ s/^(\ +)//;
+ # we must do this to switch off the utf8 flag before calling decode_mimewords
+ $string = encode_utf8($string);
+ my @mime_words = MIME::Words::decode_mimewords($string);
+ my $tmp = $leading_space .
+ join('',
+ (map {
+ if (@{$_} > 1) {
+ convert_to_utf8(${$_}[0],${$_}[1]);
+ } else {
+ decode_utf8(${$_}[0]);
+ }
+ } @mime_words)
+ );
+ return $tmp;