GNOME Bugzilla – Bug 69955
Incorrect locale behaviour
Last modified: 2004-12-22 21:47:04 UTC
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.
Sorry, in ---code--- first code string should originally look ctype=setlocale(LC_CTYPE,NULL) I've pasted my modified version :)
I've removed this code altogether since it isn't necessary anymore now that we have pango and UTF-8.