On Fri, Jan 16, 2026 at 09:39:53PM +0200, Eli Zaretskii wrote: > > Date: Fri, 16 Jan 2026 15:31:42 +0100 > > From: Patrice Dumas <[email protected]> > > Cc: [email protected], [email protected] > > > > > > if (!defined($locale_encoding) and $^O eq 'MSWin32') { > > > > eval 'require Win32::API'; > > > > if (!$@) { > > > > Win32::API::More->Import("kernel32", "int GetACP()"); > > > > my $CP = GetACP(); > > > > if (defined($CP)) { > > > > $locale_encoding = 'cp'.$CP; > > > > > > Another information I would need is the equivalent in Perl of > > determining that the console page is UTF-8. In C it is like: > > UINT cp = GetACP (); > > if (cp == CP_UTF8) > > .... > > > > What the (cp == CP_UTF8) comparison should be on the string returned by > > GetACP or GetConsoleOutputCP? > > The value of CP_UTF8 is 65001, and both GetACP and GetConsoleOutputCP > return it when the corresponding encoding is UTF-8. Both of these > functions return an integer, not a string.
In C, yes, therefore I can do the code in C, but in Perl, the GetACP() and GetConsoleOutputCP() obtained through Win32::API::More->Import call returns a string, and I would need to know what this string is gonna be for UTF-8. I couldn't find that information on the internet. -- Pat
