| Ticket UUID: | 1986818 | |||
| Title: | tkUnixKey.c: Use Xutf8LookupString if available | |||
| Type: | Patch | Version: | None | |
| Submitter: | jenglish | Created on: | 2008-06-06 19:51:21 | |
| Subsystem: | 67. Unix Window Operations | Assigned To: | jenglish | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2008-07-02 02:37:25 | |
| Resolution: | Accepted | Closed By: | jenglish | |
| Closed on: | 2008-06-11 00:42:55 | |||
| Description: |
Attached patch modifies tkUnixKey.c to use Xutf8LookupString() instead of XmbLookupString() if the former is available. This should solve problems (like #1908443) where Xlib's idea of the system encoding does not match Tcl's. Also fixes another bug whereby the results of XLookupString were being converted using the system encoding -- this is incorrect, XLookupString is documented to return ISO Latin 1 characters. (GPS, could you take a look?) | |||
| User Comments: |
jenglish added on 2008-07-02 02:37:25:
Logged In: YES user_id=68433 Originator: YES > Please commit to core-8-4-branch if possible. Just checked -- patch does not apply, as it depends on earlier changes (2008-03-26, #1919791) that were not backported to 8.4 either. (And *that* patch wasn't backported because it depends on still earlier cleanup work in tkUnixEvent.c ...) Leaving closed. dgp added on 2008-06-16 23:19:39: Logged In: YES user_id=80530 Originator: NO Please commit to core-8-4-branch if possible. jenglish added on 2008-06-11 07:42:55: Logged In: YES user_id=68433 Originator: YES Patch committed (CVS HEAD and core-8-5-branch. Possibly also applicable to core-8-4-branch.) jenglish added on 2008-06-09 00:13:36: Logged In: YES user_id=68433 Originator: YES @flatworm -- no, this patch will probably not fix #1967075. This patch addresses the case where X and Tcl disagree about the system encoding; the symptoms in #1967075 look like Xlib does not support the selected locale at all. flatworm added on 2008-06-08 06:01:48: Logged In: YES user_id=1350198 Originator: NO Tried 8.6a0 (CVS HEAD as of today) with this patch applied to test #1967075 -- unfortunately, this does not fixes the mentioned "broken locale" bug. georgeps added on 2008-06-07 23:06:23: Logged In: YES user_id=585068 Originator: NO The Status status; will have an uninitialized random value if !ic->core.im, because Xutf8LookupString doesn't set status when it returns XLookupNone (via return) in the !ic->core.im path. I think it should be something more like: Status status = XLookupNone; so that the code doesn't fall into a branch it shouldn't, because of a random value in the uninitialized status. I chose XLookupNone for status, because none of the other branch tests use that. The code should still work as is though anyway with the uninitialized value even in the !ic->core.im path, but it might result in a Tcl_DString with a length of 1, and a garbage character. It still feels like it might be a bug in Xutf8LookupString. I don't know why it's returning XLookupNone for a length, when XLookupNone is defined with a value of 1. It's also rather confusing that it doesn't do something like: *statusPtr = XLookupNone; instead in a case like this, and return 0. Perhaps that's what the author(s) of Xutf8LookupString should have done. The patch looks good after that change I think. jenglish added on 2008-06-07 08:30:45: File Added - 280502: tk-unixkey-getstring-2.patch Logged In: YES user_id=68433 Originator: YES Revised patch: reworked XBufferOverflow logic. First version was too clever, and will lead to an infinite loop if Xutf8LookupString() fails to work as expected (see also http://paste.tclers.tk/966). File Added: tk-unixkey-getstring-2.patch jenglish added on 2008-06-07 02:51:22: File Added - 280486: tk-unixkey-getstring.patch | |||
Attachments:
- tk-unixkey-getstring-2.patch [download] added by jenglish on 2008-06-07 08:30:45. [details]
- tk-unixkey-getstring.patch [download] added by jenglish on 2008-06-07 02:51:21. [details]
