Author: Bjoern HoehrmannBjoern Hoehrmann
Date: Jul 1, 2008 13:14
Hi,
Writing an example script for Win32::MultiLanguage that simply lists
all supported code pages in the user's default language, I naturally got
all the umlauts in the german output messed up in the console. Wondering
how to fix that I thought there should be a simple way to say, e.g.,
binmode STDOUT => ':encoding(:terminal)' if -t STDOUT;
I only found the :locale sub-pragma in open.pm and encoding.pm and it
seems it does not work with binmode at all and would also fail on Win32
systems due to not setting the relevant environment variables. So I've
implemented a crude and simple solution like this:
use Encode;
use Encode::Alias;
sub terminal_encoding {
my $encoding;
|