Mailinglist Archive: opensuse-bugs (7967 mails)

< Previous Next >
[Bug 241783] can't type accented characters in certain apps
  • From: bugzilla_noreply@xxxxxxxxxx
  • Date: Tue, 6 Feb 2007 15:49:27 -0700 (MST)
  • Message-id: <20070206224927.5E186D18@xxxxxxxxxxxxxxxxxxxxxx>
https://bugzilla.novell.com/show_bug.cgi?id=241783





------- Comment #14 from mfabian@xxxxxxxxxx 2007-02-06 15:49 MST -------
When looking at the original code in gtkimcontextxim.c:

GtkIMContext *
gtk_im_context_xim_new (void)
{
GtkIMContextXIM *result;
const gchar *charset;

result = g_object_new (GTK_TYPE_IM_CONTEXT_XIM, NULL);

result->locale = g_strdup (setlocale (LC_CTYPE, NULL));

g_get_charset (&charset);
result->mb_charset = g_strdup (charset);

return GTK_IM_CONTEXT (result);
}

static char *
mb_to_utf8 (GtkIMContextXIM *context_xim,
const char *str)
{
GError *error = NULL;
gchar *result;

if (strcmp (context_xim->mb_charset, "UTF-8") == 0)
result = g_strdup (str);
else
{
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;
}

one can see that the charset used to convert *from* into
UTF-8 while doing XIM is the charset of the current locale.

In case of the C/POSIX locale this is:

mfabian@magellan:~$ LC_ALL=C locale charmap
ANSI_X3.4-1968
mfabian@magellan:~$

which is another name for ASCII.

Of course trying to convert non ASCII characters from ASCII to UTF-8 with
the glibc conversion routines will report an error:

mfabian@magellan:~$ echo -n รก | iconv -f ASCII -t UTF-8
iconv: illegal input sequence at position 0
mfabian@magellan:~$


--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

< Previous Next >
References