From 71f8198a32ea19add5ed5af1f3cf882c4a6822ce Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 27 Aug 1998 02:00:35 +0000 Subject: [PATCH] (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, ""). --- src/xterm.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index aedac4714db..8b6b98019c6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6950,6 +6950,28 @@ same_x_server (name1, name2) } #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 @@ x_term_init (display_name, xrm_option, resource_name) #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 @@ x_term_init (display_name, xrm_option, resource_name) #ifdef HAVE_X11XTR6 /* I think this is to compensate for XtSetLanguageProc. */ - setlocale (LC_NUMERIC, "C"); + fixup_locale (); #endif } -- 2.39.2