On Thu, Jan 15, 2026 at 03:56:58PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 15 Jan 2026 13:49:09 +0100
> > From: Patrice Dumas <[email protected]>
> > Cc: [email protected], [email protected]
> >
> > This code seems somewhat similar to code in texi2any.c that is used to
> > determine the locale, which, I believe you proposed. It is not exactly
> > the same context, I do not think that we want the translit part, but the
> > UTF-8 part could be relevant. Just before that code, if
> > HAVE_LANGINFO_CODESET is defined, nl_langinfo (CODESET) is used.
> > Now that I look at the code more closely, it could be different as
> > the function used is diferent, GetACP versus GetConsoleOutputCP.
> > The code is currently:
> >
> > #ifdef _WIN32
> > if (!locale_encoding)
> > {
> > unsigned cp = GetACP ();
> > xasprintf (&locale_encoding, "cp%u", cp);
> > }
> > #endif
> >
> > Should there be a change to that code too?
>
> I think texi2any uses the locale's encoding for different purposes,
> but it cannot do any harm to report codepage 65001 as "UTF-8", so yes.
What would be the change to Perl equivalent code? The current code is:
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;
}
}
}
--
Pat