[9882] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] gtk bug or glibc locale bug?

daemon@ATHENA.MIT.EDU (Changwoo Ryu)
Thu Nov 5 09:03:27 1998

To: gtk-list@redhat.com
From: Changwoo Ryu <cwryu@adam.kaist.ac.kr>
Date: 05 Nov 1998 23:02:44 +0900
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

I recently upgraded several Debian packages---xfree86 with no
-DX_LOCALE, wcsmbs patch from Debian-JP and Korean locale for wcsmbs.
But after the upgrade, all my GTK+ programs didn't properly work with
multibyte language.  GTK+ library has been compiled from the source.

I attached the fix.  The patch is a part of the GTK+ XIM improvement,
<http://arch.comp.kyutech.ac.jp/~matsu/my_products/gtk/xim-1998.09.16.patch>

The problem was, the result of mblen ("\xc0", MB_CUR_MAX) was -1 in
"C" locale.  But I believe it should be 1.  Is it glibc's (or
wcsmbs's) bug?


Anyway, this patch fixes the problem.  If noone complains, I'll commit
this.

----------------------------------------------------------------------
diff -u -r1.85 gtkmain.c
--- gtkmain.c	1998/10/25 19:30:02	1.85
+++ gtkmain.c	1998/11/05 13:36:49
@@ -405,15 +405,18 @@
   current_locale = g_strdup (setlocale (LC_CTYPE, NULL));
 
 #ifdef X_LOCALE
+  /* with X_LOCALE, MB_CUR_MAX is always 4 regardless of the locale */
   if ((strcmp (current_locale, "C")) && (strcmp (current_locale, "POSIX")))
     gtk_use_mb = TRUE;
   else
+    gtk_use_mb = FALSE;
+#else
+  if ((strcmp (current_locale, "C")) && (strcmp (current_locale, "POSIX"))
+      && MB_CUR_MAX != 1)
+    gtk_use_mb = TRUE;
+  else
+    gtk_use_mb = FALSE;
 #endif
-    {
-      setlocale (LC_CTYPE, "C");
-      gtk_use_mb = (mblen ("\xc0", MB_CUR_MAX) == 1);
-      setlocale (LC_CTYPE, current_locale);
-    }
 
   g_free (current_locale);
 
----------------------------------------------------------------------

-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post