emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 3985a21: Avoid setting LC_NUMERIC on MS-Windows to


From: Eli Zaretskii
Subject: [Emacs-diffs] master 3985a21: Avoid setting LC_NUMERIC on MS-Windows to anything but "C"
Date: Mon, 10 Aug 2015 17:02:43 +0000

branch: master
commit 3985a21b5205d65bece84d1ba74f44478db78d91
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid setting LC_NUMERIC on MS-Windows to anything but "C"
    
    * src/emacs.c (synchronize_locale) [WINDOWSNT]: Call fixup_locale
    after setting LC_ALL to the desired locale, to avoid affecting how
    numbers are read and printed.  (Bug#21223)
---
 src/emacs.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index 6e35496..aace618 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2154,17 +2154,23 @@ synchronize_locale (int category, Lisp_Object *plocale, 
Lisp_Object desired_loca
 {
   if (! EQ (*plocale, desired_locale))
     {
+      *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;
+        specified.  So we ignore CATEGORY, use LC_ALL instead, and
+        then restore LC_NUMERIC to "C", so reading and printing
+        numbers is unaffected.  */
+      setlocale (LC_ALL, (STRINGP (desired_locale)
+                         ? SSDATA (desired_locale)
+                         : ""));
+      fixup_locale ();
+#else  /* !WINDOWSNT */
       setlocale (category, (STRINGP (desired_locale)
                            ? SSDATA (desired_locale)
                            : ""));
+#endif /* !WINDOWSNT */
     }
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]