in reply to Re^2: confusing result from Win32::GetACP()
in thread confusing result from Win32::GetACP()
GetACP returns the value reported by Windows. Windows reports the encoding the application must use, which is 65001 for your perl. Again, this (now) varies by process (just like chcp).
To test if Win32::GetACP and thus Windows's GetACP return the correct value, you'd have to re-implement Windows's GetACP. That's just not feasible. You'd actually be testing your re-implementation, not Win32::GetACP.
The following is the implementation of the Perl sub / XS function:
XS(w32_GetACP) { dXSARGS; if (items) Perl_croak(aTHX_ "usage: Win32::GetACP()"); EXTEND(SP,1); XSRETURN_IV(GetACP()); }
As you can see, it simply calls GetACP.
And please stop calling it the ANSI Code Page. These calls (including the Power Shell one) all return the *Active* Code Page, which is going to be *one of* the ANSI Code Pages (as opposed to one of OEM Code Pages), and the ANSI Code Pages *aren't ANSI*.
For example, 1250 and 1252 are "ANSI" Code Pages, but the process only has one Active Code Page which may or may not be 1250 or 1252.
For example, 1252 was based on the what became the ANSI standard for iso-8851-1, but 1252 is different from the ANSI standard / iso-8859-1.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: confusing result from Win32::GetACP()
by hexcoder (Curate) on Aug 21, 2025 at 07:45 UTC | |
by Discipulus (Canon) on Aug 21, 2025 at 08:03 UTC | |
by NERDVANA (Priest) on Aug 27, 2025 at 18:03 UTC | |
by ikegami (Patriarch) on Aug 27, 2025 at 23:01 UTC |