in reply to Re^3: confusing result from Win32::GetACP()
in thread confusing result from Win32::GetACP()

Thanks. I completely agree with your analysis, that's why I am so puzzled with the result.

Before going insane, I thought about "getting a second opinion" and installed another portable version of Strawberry Perl (5.40.2.1 64-bit). When running the one-liner there, I get the expected result (1252).

So, depending on the Perl version i use, I get 1252 or 65001 as a result. Clearly there must be something fishy in the previous Perl installation, but it seems difficult to debug.

And please stop calling it the ANSI Code Page.
Ok, will do. My impression was that this the official wording.
  • Comment on Re^4: confusing result from Win32::GetACP()

Replies are listed 'Best First'.
Re^5: confusing result from Win32::GetACP()
by Discipulus (Canon) on Aug 21, 2025 at 08:03 UTC
    Hello hexcoder,

    I always get 1252 with my strawberries plus an error for 5.12

    | Use of inherited AUTOLOAD for non-method Win32::GetACP() is depreca +ted at | -e line 1. | Can't locate auto/Win32/GetACP.al in @INC (@INC contains: | ./perl5.12-32bit/perl/site/lib | ./perl5.12-32bit/perl/vendor/lib | ./perl5.12-32bit/perl/lib .) at -e line 1 [OK] .\perl5.12-32bit\perl\bin\perl.exe | 1252 [OK] .\perl5.20.64bit\perl\bin\perl.exe | 1252 [OK] .\perl5.22.64bit\perl\bin\perl.exe | 1252 [OK] .\perl5.24.64bit\perl\bin\perl.exe | 1252 [OK] .\perl5.26.64bit\perl\bin\perl.exe | 1252 [OK] .\perl-5.26.64bit-PDL\perl\bin\perl.exe | 1252 [OK] .\perl5.28.32bit\perl\bin\perl.exe | 1252 [OK] .\perl5.28-64bit\perl\bin\perl.exe | 1252 [OK] .\perl5.32\perl\bin\perl.exe | 1252 [OK] .\perl5.32.64bit\perl\bin\perl.exe

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^5: confusing result from Win32::GetACP()
by NERDVANA (Priest) on Aug 27, 2025 at 18:03 UTC
    IMO getting the perl manifest changed to use ACP 65001 is the ideal configuration, anyway. This allows you to write unicode filenames on Windows the same as on Linux (encode to utf-8 first). Otherwise if you want to write a character that isn't in your codepage you need a bunch of special cases like if ($^O eq 'MSWin32') { OpenFileW($name); ... }

      Aye. I created a ticket for this a while ago.