[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-38.3.0esr-5.0-2] fixup! Bug #5926: Allow JS locale to be set to English/C.



commit 6d36430a07b75db21fb4007f28cceb98adc23f35
Author: Arthur Edelstein <arthuredelstein@xxxxxxxxx>
Date:   Thu Oct 15 22:10:48 2015 +0000

    fixup! Bug #5926: Allow JS locale to be set to English/C.
    
    Fixes #17329: Use the UTF-8 version of the "C" locale to
    ensure that non-ASCII characters can be typed.
---
 xpcom/build/XPCOMInit.cpp |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp
index 292652d..ec1f6c9 100644
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -520,7 +520,15 @@ void UseUSEnglishLocalePrefChangedCallback(const char* /* pref */, void* /* clos
     // Read the pref to see if we will use US English locale.
     bool useUSEnglishLocale = mozilla::Preferences::GetBool(USE_US_ENGLISH_LOCALE_PREF, false);
     // Set the application-wide C-locale. Needed for Date.toLocaleFormat().
-    setlocale(LC_ALL, useUSEnglishLocale ? "C" : sSystemLocale);
+    if (useUSEnglishLocale) {
+      // Set the locale to "C.UTF-8" if possible, to avoid interfering with non-ASCII
+      // keyboard input on some Linux desktops.
+      // Otherwise fall back to the "C" locale, which is available on all platforms.
+      // See https://bugs.torproject.org/17329
+      setlocale(LC_ALL, "C.UTF-8") || setlocale(LC_ALL, "C");
+    } else {
+      setlocale(LC_ALL, sSystemLocale);
+    }
     // Now override the JavaScript Runtime Locale that is used by the Intl API
     // as well as Date.toLocaleString, Number.toLocaleString, and String.localeCompare.
     JS_SetDefaultLocale(rt, useUSEnglishLocale ? "en-US" : sJSLocale);

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits