changeset 23115:b992f7bb67d7

(fixup_locale): New function. For now, it resets LC_TIME to "C" (reverting the 1998-08-07 change), and also resets LC_MESSAGES to "C". (x_term_init): Use it to fix up the locale after setlocale (LC_ALL, "").
author Paul Eggert <eggert@twinsun.com>
date Thu, 27 Aug 1998 02:00:35 +0000
parents e51b304d8195
children 6736da064f4a
files src/xterm.c
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Thu Aug 27 01:23:52 1998 +0000
+++ b/src/xterm.c	Thu Aug 27 02:00:35 1998 +0000
@@ -6950,6 +6950,28 @@
 }
 #endif
 
+#if defined (HAVE_X_I18N) || (defined (USE_X_TOOLKIT) && defined (HAVE_X11XTR6))
+/* Recover from setlocale (LC_ALL, "").  */
+static void
+fixup_locale ()
+{
+  /* Currently we require strerror to use the "C" locale,
+     since we don't yet support decoding its string result.  */
+#ifdef LC_MESSAGES
+  setlocale (LC_MESSAGES, "C");
+#endif
+
+  /* The Emacs Lisp reader needs LC_NUMERIC to be "C",
+     so that numbers are read and printed properly for Emacs Lisp.  */
+  setlocale (LC_NUMERIC, "C");
+
+  /* Currently we require strftime to use the "C" locale,
+     since we don't yet support encoding its format argument,
+     or decoding its string result.  */
+  setlocale (LC_TIME, "C");
+}
+#endif
+
 struct x_display_info *
 x_term_init (display_name, xrm_option, resource_name)
      Lisp_Object display_name;
@@ -6973,8 +6995,7 @@
 
 #ifdef HAVE_X_I18N
   setlocale (LC_ALL, "");
-  /* In case we just overrode what init_lread did, redo it.  */
-  setlocale (LC_NUMERIC, "C");
+  fixup_locale ();
 #endif
 
 #ifdef USE_X_TOOLKIT
@@ -7005,7 +7026,7 @@
 
 #ifdef HAVE_X11XTR6
     /* I think this is to compensate for XtSetLanguageProc.  */
-    setlocale (LC_NUMERIC, "C");
+    fixup_locale ();
 #endif
   }