in reply to Re^3: 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.

"here $from is 'MIME-Header'"

Shouldn't it be 'utf8'?


The way forward always starts with a minimal test.
  • Comment on Re^4: How to know to know if string is utf8 encoded or decoded.

Replies are listed 'Best First'.
Re^5: How to know to know if string is utf8 encoded or decoded.
by Anonymous Monk on Jul 26, 2019 at 04:01 UTC

    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.

        Thank you for the reply.
        That is existing code. basically the logic behind the code is, if filename is utf8 encoded then return the string as it is but if it is not then decode it using encode::decode.

        for filename "test1℗ὓ.txt" there is not need to decode at all but with filename "1669-SCC-HôpitauxdeSaint-Maurice-POC.PIF", it is not working with or without decode. when I say not working it is not getting decoded properly so that file is not getting attached.