in reply to Re^2: How to know to know if string is utf8 encoded or decoded.
in thread How to know to know if string is utf8 encoded or decoded.

eval { $unicode = Encode::decode($from,$str); #here $from is +'MIME-Header' }; if ($@) { &ConvertEncodingError("($from -> utf8)\n$@"); return $str; }

Replies are listed 'Best First'.
Re^4: How to know to know if string is utf8 encoded or decoded.
by 1nickt (Canon) on Jul 25, 2019 at 23:22 UTC

    "here $from is 'MIME-Header'"

    Shouldn't it be 'utf8'?


    The way forward always starts with a minimal test.

      No, it should not utf8 there.
      Thank you

        I don't understand. Why do you think that Encode::decode('MIME-Header',$str) is going to do anything useful?

        $ perl -Mstrict -MEncode -wE 'my $str="foo"; say encode("MIME-Header", + $str);' =?UTF-8?B?Zm9v?=


        The way forward always starts with a minimal test.