[gnome-cyr] [Bug 69955] New - Incorrect locale behaviour



Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

http://bugzilla.gnome.org/show_bug.cgi?id=69955

Changed by dmitry taurussoft org 

--- shadow/69955	Tue Jan 29 03:56:15 2002
+++ shadow/69955.tmp.17563	Tue Jan 29 03:56:15 2002
@@ -0,0 +1,58 @@
+Bug#: 69955
+Product: libgnomeui
+Version: 1.109
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: critical
+Priority: Normal
+Component: general
+AssignedTo: andersca gnu org                            
+ReportedBy: dmitry taurussoft org               
+TargetMilestone: ---
+URL: 
+Summary: Incorrect locale behaviour
+
+I see many "Locale not supported by C library" warnings. Seems following
+peace of code in libgnomeui/gnome-ui-init.c in libgnomeui_pre_args_parse
+causes them.
+
+---code---
+        /* Begin hack to propogate an en_US locale into Gtk+ if LC_CTYPE=C,
+so that non-ASCII
+           characters will display for as many people as possible. Related
+to bug #1979 */
+        ctype = setlocale (LC_CTYPE, "");
+	g_print("Ctype: %s\n", ctype);
+
+        if (strcmp (ctype, "C") == 0) {
+                old_ctype = g_strdup (g_getenv ("LC_CTYPE"));
+                gnome_setenv ("LC_CTYPE", "en_US", TRUE);
+                ctype_set = TRUE;
+        } else {
+                ctype_set = FALSE;
+	}
+
+        gtk_set_locale ();
+
+        if (ctype_set) {
+                if (old_ctype) {
+			gnome_setenv ("LC_CTYPE", old_ctype, TRUE);
+                        g_free (old_ctype);
+                } else {
+			gnome_unsetenv ("LC_CTYPE");
+		}
+        }
+        /* End hack */
+---code---
+
+On my machine with properly set locale (LANG=ru_RU.KOI8-R) call to
+setlocale(LC_CTYPE, NULL) sets ctype variable to C and hack always run.
+After call to gtk_set_locale() locale becomes C too.
+According to man it's necessary to initialize locale first with call to
+setlocale(XXX,"").
+There are two possibilities to do so
+1. Change ctype=setlocale(LC_CTYPE, NULL) to setlocale(LC_CTYPE,""). I've
+made such modification and all warnigs gone.
+2. Place gtk_set_locale() before begin of the hack.




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