Subject: bug#79296: 30.2; format-time-string returns wrongly encoded string in MS Windows Japanese with cp65001 beta config

From: Eli Zaretskii <[email-masked]>
Date: Sun, 24 Aug 2025 12:12:20 +0300

> Date: Sun, 24 Aug 2025 17:14:37 +0900
> From: Shingo Tanaka <[email-masked]>
> Cc: Shingo Tanaka <[email-masked]>,
> 	Paul Eggert <[email-masked]>,
> 	[email-masked]
> 
> Hi Eli, Bruno,
> 
> >   > Shingo Tanaka, could you please tell what is the value of
> >   > w32-multibyte-code-page on your system, both when "Beta: Use Unicode
> >   > UTF-8 for worldwide language support" is ON and when it is OFF?
> > 
> >   Yes, this info would be useful.
> 
> Here is the results. Looks like the value of w32-multibyte-code-page is wrong?
> 
> - "Beta: Use Unicode UTF-8 for worldwide language support": OFF
> 
> w32-system-coding-system
> cp932
> 
> w32-multibyte-code-page
> 932
> 
> w32-ansi-code-page
> 932
> 
> - "Beta: Use Unicode UTF-8 for worldwide language support": ON
> 
> w32-system-coding-system
> cp65001
> 
> w32-multibyte-code-page
> 0
> 
> w32-ansi-code-page
> 65001
> 
> Please let me know if you need further information.

Thanks.  This means w32-multibyte-code-page doesn't provide a good way
of detecting Japanese Windows where the system codepage was changed to
be UTF-8.  What other aspects of your environment can be evidence that
this is the case?  Please tell what do the following produce when
evaluated via "M-:" in a running Emacs session.  Please show the
values both when "Beta: Use Unicode UTF-8 for worldwide language
support" is ON and when it is OFF.

  (w32-get-current-locale-id)
  (w32-get-locale-info (w32-get-current-locale-id))
  (w32-get-default-locale-id)
  (w32-get-locale-info (w32-get-default-locale-id))
  (w32-get-console-codepage)
  (w32-get-console-output-codepage)

Hopefully, some of these will allow us to identify the combination of
a Japanese Windows with UTF-8 as a system codepage.