perl-unicode

Re: Tk804 input and LC_CTYPE=xy.utf8

2003-10-30 06:30:05
Petr Pajas <pajas(_at_)ufal(_dot_)ms(_dot_)mff(_dot_)cuni(_dot_)cz> writes:
Hi Nick, All,

as we discussed here before, one needs to set $top->useinputmethods(1)
to make Tk804 accept accented characters from various national keymaps
in X. However, this seems to break still with UTF8 locale settings
(which are default on RH8 and RH9 for most languages).

RedHat are generaly considered to be premature in making the switch.


In my case, I cannot input czech characters if I 

unset LC_ALL
export LANG="cs_CZ.utf8"
export LC_CTYPE="cs_CZ.utf8"

Setting LC_CTYPE="cs_CZ" works though (but may break other
applications, like Qt, etc). My test script looks as below.  With
cs_CZ.utf8, $w->XEvent->A is empty, while all other values are
correct. With cs_CZ, $w->XEvent->A returns the correct utf8 encoded
character and that character appears in the Entry.

Does anybody have an idea what could cause this problem? Anybody else
using national keyboard maps and UTF8 locale?

There is _a_ UTF-8 input map in my SuSE's X11 - I think this is 
an XFree86 type question. But I am copying this to perl-unicode list 
as there folk there may have some insight...



#!/usr/bin/perl
package main;

use Tk 804;
use Tk::Entry;

use POSIX;
setlocale('LC_CTYPE',"cs_CZ.utf8");
use locale;

$top = MainWindow->new;
$top->useinputmethods(1);  # Try this?
binmode(STDOUT,':utf8');
$top->bind("<KeyPress>", sub { my $w=shift; 
                             print $w->XEvent->A," ",
                               $w->XEvent->N, " ",
                                 $w->XEvent->K, " ",
                                   $w->XEvent->k,
                               "\n" });
$e=$top->Entry->pack;
$e->focus();
MainLoop;
__END__

Same applies to Russian, etc. I tried setting several national
keyboards with setxkbmap and kxkb (KDE), with the same result.  (BTW,
"setxkbmap ru" is dangerous, 'cause you cannot type "us" then:-) to
get back to normal.  "setxkbmap cz" is safe though, since on czech
keyboard accented letters occupy just the top row of the keyboard with
numbers being remapped to shift+number and the rest of the keyboard is
(almost) like us, so you may always switch back by typing "setxkbmap
us").

-- Petr

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Tk804 input and LC_CTYPE=xy.utf8, nick <=