From ad80180d0f2fc2ea422cf7ca5bdcc636c0600744 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Mar 2015 17:44:00 +0200 Subject: [PATCH] Fix problems with setting system-time-locale on MS-Windows src/emacs.c (synchronize_locale) [WINDOWSNT]: Ignore 'category' and always use LC_ALL instead. Fixes problems with setting system-time-locale to something non-default. --- src/ChangeLog | 6 ++++++ src/emacs.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index bdec3c9cde1..5aa248e91b9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2015-03-21 Eli Zaretskii + + * emacs.c (synchronize_locale) [WINDOWSNT]: Ignore 'category' and + always use LC_ALL instead. Fixes problems with setting + system-time-locale to something non-default. + 2015-03-18 Glenn Morris * frame.h (x_set_bitmap_icon): Don't set the icon if icon-type is diff --git a/src/emacs.c b/src/emacs.c index d318fd4649a..70db900246a 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2152,6 +2152,13 @@ synchronize_locale (int category, Lisp_Object *plocale, Lisp_Object desired_loca { if (! EQ (*plocale, desired_locale)) { +#ifdef WINDOWSNT + /* Changing categories like LC_TIME usually requires to specify + an encoding suitable for the new locale, but MS-Windows's + 'setlocale' will only switch the encoding when LC_ALL is + specified. So we ignore CATEGORY and use LC_ALL instead. */ + category = LC_ALL; +#endif *plocale = desired_locale; setlocale (category, (STRINGP (desired_locale) ? SSDATA (desired_locale) -- 2.39.2