in reply to Re: encoding for $!
in thread encoding for $!

My point was to find a solution which doesn't require fixing $! everywhere we get it. With tied $_ we should copy $! into $_ everywhere we get it, which doesn't really differ from doing decode('UTF-8',$!) inplace.

Looks like best solution for now is force "en_US.UTF-8" (at least this can be done once at beginning of script) or wait until perl-5.22 (which may fix this issue).

use POSIX qw(locale_h); BEGIN { setlocale(LC_MESSAGES,"en_US.UTF-8") }

Replies are listed 'Best First'.
Re^3: encoding for $!
by remiah (Hermit) on Jun 29, 2014 at 11:13 UTC

    sorry, mistyped.

    use DecodedMsg; tie $! , "DecodedMsg";
    see test4 example. But I also think setting LANG to en_US.UTF-8 is better solution. regards.

      Isn't tie $! will break existing $! magic?