in reply to Re: I/O encoding question
in thread I/O encoding question

Oh well.

I haven't run into any problems with non-unicode editors for… five years or so. Maybe it's just that I don't view some problems as such; one stops noticing these things. There are at least 5 occasionally-used single-byte encodings for Russian.

I've built a more-or-less complete Unicode toolchain several years ago.

My problem was fixed with

binmode(STDOUT,':utf8'); binmode(STDIN,':utf8');

I actually expected this to be the default.

Replies are listed 'Best First'.
Re^3: I/O encoding question
by Joost (Canon) on May 06, 2007 at 21:31 UTC
    IIRC perl 5.8.0 used to set STDIN & STDOUT to unicode when you had $ENV{LANG} set to a unicode language/encoding (like en_US.UTF-8) but that caused too many problems with backward compatibility, so now you have to explictly set the output and input encoding.

    Note that use utf8 only sets the encoding of the script. It has no influence on the input/output encodings.

Re^3: I/O encoding question
by almut (Canon) on May 06, 2007 at 22:35 UTC

    Just for the sake of completeness: you could also have used the commandline switch -C.  In your case, to set the UTF-8-ness of the filehandles STDIN and STDOUT:

    #!/usr/bin/perl -CIO use utf8; # the script's encoding, i.e. literal strings, regexes # ...

    (or, instead of -CIO, you could have written -C3, if you like it shorter...)  See perlrun for the details.