gnucash stable: mingw32: Use msvcrt's _wsetlocale in set_platform_ctype_to_acp.

John Ralls jralls at code.gnucash.org
Wed Sep 16 21:00:44 EDT 2026


Updated	 via  https://github.com/Gnucash/gnucash/commit/6b69ea72 (commit)
	from  https://github.com/Gnucash/gnucash/commit/e27a3c62 (commit)



commit 6b69ea727868fa5b550e04167d0a3ab6d2759619
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Sep 16 17:57:17 2026 -0700

    mingw32: Use msvcrt's _wsetlocale in set_platform_ctype_to_acp.
    
    The setlocale we get is from libintl which doesn't do anything for
    locale "C".
    
    This commit should be reverted immediately after merging into future.
    
    Assisted-by: Claude Code Opus 5
    Signed-off: John Ralls <jralls at ceridwen.us>

diff --git a/gnucash/gnucash-locale-windows.c b/gnucash/gnucash-locale-windows.c
index a542af2cbb..761d99b855 100644
--- a/gnucash/gnucash-locale-windows.c
+++ b/gnucash/gnucash-locale-windows.c
@@ -154,6 +154,7 @@ set_platform_locale(void)
 void
 set_platform_ctype_to_acp (void)
 {
-    // The C locale is always aligned with ACP.
-    setlocale (LC_CTYPE, "C");
+    // The C locale is always aligned with ACP. Use _wsetlocale because
+    // libintl's setlocale replacement refuses "C" when the ACP is UTF-8.
+    _wsetlocale (LC_CTYPE, L"C");
 }



Summary of changes:
 gnucash/gnucash-locale-windows.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list