Bug 12759

Summary: Thai XIM fails to retrieve multi-byte surrounding text on UTF-8 locale
Product: xorg Reporter: Theppitak Karoonboonyanan <thep>
Component: Lib/XlibAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium Keywords: i18n, patch
Version: 7.3 (2007.09)   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Patch to convert multi-byte text before using it
none
Cleaner patch, without explicit codeset checks none

Description Theppitak Karoonboonyanan 2007-10-09 19:15:27 UTC
On th_TH.UTF-8 locale, Thai XIM rejects all combining characters for GTK+ apps that use X Input Method.

This is because GTK+ imxim immodule passes surrounding text in locale encoding, which is UTF-8 for UTF-8 locales. But current Thai XIM in Xlib assumes the multi-byte StringConversionText response for the StringConversionCallback to always be TIS-620, by retrieving a single byte and using it as-is.

If the Thai XIM tries to convert the multi-byte text based on locale codeset before using it, it will work again.
Comment 1 Theppitak Karoonboonyanan 2007-10-09 19:17:12 UTC
Created attachment 11963 [details] [review]
Patch to convert multi-byte text before using it
Comment 2 Theppitak Karoonboonyanan 2008-07-15 01:26:57 UTC
Changed component to Lib/Xlib. This should be more correct.
Comment 3 Theppitak Karoonboonyanan 2008-07-17 08:02:49 UTC
Created attachment 17726 [details] [review]
Cleaner patch, without explicit codeset checks

Rather than explicitly checking locale's codeset, let's use the converter in a more generic way.
Comment 4 Theppitak Karoonboonyanan 2008-09-26 19:06:30 UTC
Note: This bug seems to contribute to LP #273856 [1] against Ubuntu Intrepid when XIM is chosen as the input method.

  [1] https://bugs.launchpad.net/ubuntu/+bug/273856
Comment 5 Theppitak Karoonboonyanan 2009-02-09 18:24:19 UTC
*ping*

Note that this patch has been applied in Ubuntu Intrepid [1], and Thai Ubuntu
users are happy with that.

  [1] https://bugs.launchpad.net/ubuntu/+bug/273856/comments/26

In fact, this bug is found in Debian, too. I just didn't file a Debian bug
because I've already filed it here upstream. It seems to be a common practice
for Debian to just forward bugs upstream (e.g. [2]). So, filing bug there
appears to be redundant, once it's reported upstream.

  [2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=443800

How about fixing this?
Comment 6 Thanomsub Noppaburana 2009-02-11 23:09:31 UTC
I found this bug in openSUSE 11.1 which is using libX11-1.1.5, too.

And everything work fine after i applied these patches:

  - Patch of bug #12759 (this bug) for fix Thai XIM fails to retrieve multi-byte surrounding text on UTF-8 locale
  - Patch of bug #12517 for fix Thai XIM does not filter inputs when NumLock/CapsLock is on
  - Patch of bug #16457 for fix CharSet-to-CompoundText Conversion Failed for Thai Locales
Comment 7 Julien Cristau 2009-04-13 09:32:06 UTC
commit 128daff4422f973ea40dd1e31b2db230e643549e
Author: Theppitak Karoonboonyanan <thep@linux.thai.net>
Date:   Thu Apr 9 12:01:07 2009 +0700

    Thai XIM not retrieve MB surrounding on UTF-8 LC
    
    On th_TH.UTF-8 locale, Thai XIM rejects all combining characters for GTK+ ap
    that use X Input Method.
    
    This is because GTK+ imxim immodule passes surrounding text in locale encodi
    which is UTF-8 for UTF-8 locales. But current Thai XIM in Xlib assumes the
    multi-byte StringConversionText response for the StringConversionCallback to
    always be TIS-620, by retrieving a single byte and using it as-is.
    
    If the Thai XIM tries to convert the multi-byte text based on locale codeset
    before using it, it will work again.
    
    X.Org But 12759 <http://bugs.freedesktop.org/show_bug.cgi?id=12759>
    
    Signed-off-by: Theppitak Karoonboonyanan <thep@linux.thai.net>
    Signed-off-by: Julien Cristau <jcristau@debian.org>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.