pcouderc has asked for the wisdom of the Perl Monks concerning the following question:

Hi, My (linux) computer is utf8. so I use to add in my scripts :
use utf8; binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8");
In fact, I do not want to add that. I did use ASCII, LATIN1, LATIN9 years ago, but no more.

Is it possible to parametrize perl use utf8 everywhere by default ?
And get rid of these declarations.

Replies are listed 'Best First'.
Re: Permanent utf8
by PerlSufi (Friar) on Jul 10, 2014 at 15:15 UTC
      And yet, even if we do everything that tchrist recommended, something as simple as "... or die $!;" will easily produce mojibake if STDERR is utf-8.
Re: Permanent utf8
by AppleFritter (Vicar) on Jul 10, 2014 at 16:11 UTC

    I wondered about the same thing a while ago, and was given the following "magic incantation" for defaulting to UTF-8 for both opening files and the STD* filehandles:

    use open IO => ':utf8', ':std';

    That said, there are reasons why Unicode isn't the default; see e.g. why no default unicode?. tchrist's insights on Unicode (already mentioned above) are also worth reading.

      there are reasons why Unicode isn't the default
      Let's be frank here. The reason why UTF-8 isn't the default is that Latin-1 is the default.
Re: Permanent utf8
by farang (Chaplain) on Jul 10, 2014 at 19:47 UTC

    utf8::all

    Not a total cure-all, but easy and effective for a great number of situations.

Re: Permanent utf8
by Anonymous Monk on Jul 10, 2014 at 15:32 UTC
    Is it possible to parametrize perl use utf8 everywhere by default ?
    Basically, no. And you should be aware that there is a lot of places where Perl expects or produces binary strings.
Re: Permanent utf8
by pcouderc (Monk) on Jul 23, 2014 at 09:48 UTC
    Thank you all.
    I see that there is no satisfactory answer. PERL has not invented UTF8
    We still remain after Babel...