Skip g_convert when to_codeset and from_codeset are both 'UTF-8' (gnome

* modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8):
	Skip g_convert when to_codeset and from_codeset are both 'UTF-8'
	(gnome bugzilla #58202)
This commit is contained in:
Hidetoshi Tajima 2001-08-06 17:09:26 +00:00
parent a4be7d83c1
commit 29d11da8c6
8 changed files with 61 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2001-08-06 HideToshi Tajima <tajima@eng.sun.com>
* modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8):
Skip g_convert when to_codeset and from_codeset are both 'UTF-8'
(gnome bugzilla #58202)
2001-08-06 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole

View File

@ -1,3 +1,9 @@
2001-08-06 HideToshi Tajima <tajima@eng.sun.com>
* modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8):
Skip g_convert when to_codeset and from_codeset are both 'UTF-8'
(gnome bugzilla #58202)
2001-08-06 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole

View File

@ -1,3 +1,9 @@
2001-08-06 HideToshi Tajima <tajima@eng.sun.com>
* modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8):
Skip g_convert when to_codeset and from_codeset are both 'UTF-8'
(gnome bugzilla #58202)
2001-08-06 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole

View File

@ -1,3 +1,9 @@
2001-08-06 HideToshi Tajima <tajima@eng.sun.com>
* modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8):
Skip g_convert when to_codeset and from_codeset are both 'UTF-8'
(gnome bugzilla #58202)
2001-08-06 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole

View File

@ -1,3 +1,9 @@
2001-08-06 HideToshi Tajima <tajima@eng.sun.com>
* modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8):
Skip g_convert when to_codeset and from_codeset are both 'UTF-8'
(gnome bugzilla #58202)
2001-08-06 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole

View File

@ -1,3 +1,9 @@
2001-08-06 HideToshi Tajima <tajima@eng.sun.com>
* modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8):
Skip g_convert when to_codeset and from_codeset are both 'UTF-8'
(gnome bugzilla #58202)
2001-08-06 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole

View File

@ -1,3 +1,9 @@
2001-08-06 HideToshi Tajima <tajima@eng.sun.com>
* modules/input/gtkimcontextxim.c (mb_to_utf8), xim_text_to_utf8):
Skip g_convert when to_codeset and from_codeset are both 'UTF-8'
(gnome bugzilla #58202)
2001-08-06 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): The whole

View File

@ -281,14 +281,18 @@ mb_to_utf8 (GtkIMContextXIM *context_xim,
GError *error = NULL;
gchar *result;
result = g_convert (str, -1,
"UTF-8", context_xim->mb_charset,
NULL, NULL, &error);
if (!result)
if (strcmp (context_xim->mb_charset, "UTF-8") == 0)
result = g_strdup (str);
else
{
g_warning ("Error converting text from IM to UTF-8: %s\n", error->message);
g_error_free (error);
result = g_convert (str, -1,
"UTF-8", context_xim->mb_charset,
NULL, NULL, &error);
if (!result)
{
g_warning ("Error converting text from IM to UTF-8: %s\n", error->message);
g_error_free (error);
}
}
return result;
@ -603,11 +607,14 @@ xim_text_to_utf8 (GtkIMContextXIM *context, XIMText *xim_text, gchar **text)
return 0;
}
result = g_convert (xim_text->string.multi_byte,
-1,
"UTF-8",
context->mb_charset,
NULL, NULL, &error);
if (strcmp (context->mb_charset, "UTF-8") == 0)
result = g_strdup (xim_text->string.multi_byte);
else
result = g_convert (xim_text->string.multi_byte,
-1,
"UTF-8",
context->mb_charset,
NULL, NULL, &error);
if (result)
{