Bug 78804 - Xutf8LookupString fails in UTF-8 locale if X server lacks XKB support
Summary: Xutf8LookupString fails in UTF-8 locale if X server lacks XKB support
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: XFree86
Version: 8.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Mike A. Harris
QA Contact: David Lawrence
URL: http://www.cl.cam.ac.uk/~mgk25/ucs/xe...
Depends On:
TreeView+ depends on / blocked
Reported: 2002-11-30 20:42 UTC by Markus Kuhn
Modified: 2007-04-18 16:48 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2002-12-15 10:27:00 UTC

Attachments (Terms of Use)
Xfree86 patch 5513 by Ivan Pascal <pascal@info.tsu.ru> (791 bytes, patch)
2002-12-06 15:28 UTC, Markus Kuhn
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2003:067 0 high SHIPPED_LIVE : Updated XFree86 packages provide security and bug fixes 2003-06-25 04:00:00 UTC

Description Markus Kuhn 2002-11-30 20:42:18 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827

Description of problem:
Xutf8LookupString performs an unnecessary ISO 8859-1 -> UTF-8 translation,
thereby corrupting keyboard input data. This happens only if the X client runs
on Red Hat 8.0 in a UTF-8 locale *and* the X server does not have XKB activated,
is for example the case by default with the Solaris 5.8 X server.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Use an X server with XKB disabled
2. LC_ALL=en_GB.UTF-8 xterm (with correct ISO10646-1 fonts)
3. If you have no non-ASCII keysym on your keyboard (e.g., you have US
keyboard), then map with xmodmap a keysym such as adiaeresis) onto
a key and press it in the xterm.

Actual Results:  The application in the xterm receives the UTF-8 sequence for
the keystream as if it had been passed unnecessarily through a ISO 8859-1 ->
UTF-8 converter.

Expected Results:  The correct UTF-8 sequence should have been received and the
correct character appear on the screen (d).

Additional info:

This bug was located on 2002-11-29 by Ivan Pascal (pascal.ru),
explained the same day on the i18n mailing list and fixed in patch
number 5513 sent to XFree86.Org:

--- xc/lib/X11/XKB.c.orig	Fri Nov 29 11:13:59 2002
+++ xc/lib/X11/XKB.c		Fri Nov 29 11:16:16 2002
@@ -417,9 +417,10 @@
     unsigned	values;
-    if ((dpy->flags & XlibDisplayNoXkb) ||
-	(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
-	return False;
+	if (!dpy->xkb_info)
+	   XkbUseExtension(dpy,NULL,NULL);
+	if (!dpy->xkb_info)
+	   return 0;
     affect&= XkbLC_AllControls;
     dpy->xkb_info->xlib_ctrls&= ~affect;
     dpy->xkb_info->xlib_ctrls|= (affect&values);
@@ -434,9 +435,10 @@
     Display *	dpy;
-    if ((dpy->flags & XlibDisplayNoXkb) ||
-	(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
-	return 0;
+	if (!dpy->xkb_info)
+	   XkbUseExtension(dpy,NULL,NULL);
+	if (!dpy->xkb_info)
+	   return 0;
     return dpy->xkb_info->xlib_ctrls;

For more information, see the thread "XFree86 Xutf8LookupString BUG with Solarix
X server" started by myself on 2002-11-28 on i18n.

Comment 1 Mike A. Harris 2002-12-06 15:20:52 UTC
Please attach the patch as a file attachment.  Cut and pasted patches
always get munged in bugzilla.

Comment 2 Mike A. Harris 2002-12-06 15:23:00 UTC
Oh, I forgot to mention...   I'll put this into my next erratum for 8.0
which will be 4.2.1 based.


Comment 3 Markus Kuhn 2002-12-06 15:28:29 UTC
Created attachment 87665 [details]
Xfree86 patch 5513 by Ivan Pascal <pascal.ru>

Comment 4 Mike A. Harris 2002-12-15 10:27:00 UTC
Thanks Markus.  Patch applied to my 4.2.1-9.6 build.  Will be in
future erratum release.  This should probably be commited to the
xf-4_2-branch by someone with CVS write permission also.

Closing as ERRATA, as it will be public when errata is released.

Note You need to log in before you can comment on or make changes to this bug.