in reply to Changing code page from perl

$CONSOLE->InputCP(1252);

Win32::Console

[system("chcp 1252");] seems to spawn a shell, change the code page there

While that's true, it doesn't matter. The OEM code page is a console setting, not a per-process setting.

>perl -MData::Dumper -e"$Data::Dumper::Useqq=1; system('chcp 1252'); print(Dumper(`dir /b *.txt`)); system('chcp 437'); print(Dumper(`dir /b *.txt`));" Active code page: 1252 $VAR1 = "\355.txt\n"; Active code page: 437 $VAR1 = "\241.txt\n";

Replies are listed 'Best First'.
Re^2: Changing code page from perl
by Anonymous Monk on Sep 24, 2010 at 11:49 UTC
    Thank you! Win32::Console is just what I needed.