On Thu, Jan 15, 2026 at 02:18:48PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 15 Jan 2026 03:24:29 +0100
> > From: Patrice Dumas <[email protected]>
> > Cc: [email protected], [email protected]
> >
> > On Wed, Jan 14, 2026 at 07:04:07PM +0200, Eli Zaretskii wrote:
> > > The following problems are with compilation in tta/
> >
> > Thanks for the reports and code, it is committed.
>
> Thanks.
>
> Here are a few more minor MinGW-related cleanups, which:
>
> . remove code no longer needed
> . move function redirections to where the functions are used
> . avoid compiler warnings due to mismatch in function signatures
> . return "UTF-8" when the Windows terminal uses UTF-8 encoding
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?
>
> --- ./info/pcterm.c~0 2026-01-01 20:44:32.000000000 +0200
> +++ ./info/pcterm.c 2026-01-15 14:12:42.482833700 +0200
> @@ -827,33 +827,26 @@ rpl_nl_langinfo (nl_item item)
> if (item == CODESET)
> {
> static char buf[100];
> + UINT console_cp = GetConsoleOutputCP ();
>
> - /* We need all the help we can get from GNU libiconv, so we
> - request transliteration as well. */
> - sprintf (buf, "CP%u//TRANSLIT", GetConsoleOutputCP ());
> + /* The rest of the code wants to see "UTF-8" and nothing else. */
> + if (console_cp == CP_UTF8)
> + memcpy (buf, "UTF-8", sizeof "UTF-8");
> + else if (console_cp == CP_UTF7)
> + sprintf (buf, "CP%u", console_cp);
> + else
> + {
> + /* For non-UTF output encoding, we need all the help we can
> + get from GNU libiconv, so we request transliteration as
> + well. */
> + sprintf (buf, "CP%u//TRANSLIT", console_cp);
> + }
> return buf;
> }
> else
> return nl_langinfo (item);
> }