Bug#514212: console-setup: on UTF-8 console, caps lock is turned into a shift lock
Hello,
Anton Zinoviev, le Thu 05 Feb 2009 14:58:46 +0200, a écrit :
> On Thu, Feb 05, 2009 at 12:39:08PM +0100, Samuel Thibault wrote:
> >
> > I don't have the time to develop right now, but the idea would then be
> > to double the number of keymaps to 128, to have "capsed" versions of
> > each of the current keycode translations.
>
> A good idea. :)
Thanks for having implemented it!
Just an additional needed fixup: with the current svn, capitalization of
non-ascii letters does not work for two reasons:
- one needs to use locales to get locale-specific capitalization (e.g.
in turkish, capitalization of i is not I but an I with dot above).
- for compatibility reasons, when chr() is given a value between 0 and
0xff, it builds an 8bit char, not a unicode char. The problem is that
uc() then does not work in UTF-8 locales. Using pack("U",...) always
produces a unicode char.
See attached patch.
Samuel
Index: ckbcomp
===================================================================
--- ckbcomp (révision 57763)
+++ ckbcomp (copie de travail)
@@ -19,6 +19,7 @@
use warnings 'all';
use strict;
+use locale;
my $debug_flag = 1;
sub debug {
@@ -3149,7 +3150,7 @@
# warning "Forbidden Unicode \"U+$kernelkeysym\"\n";
return 'VoidSymbol';
} else {
- if (chr($uni) =~ /\p{IsAlpha}/) {
+ if (pack("U", $uni) =~ /\p{IsAlpha}/) {
my $legacy = uni_to_legacy ($uni);
if ($legacy ne 'VoidSymbol') {
return '+'. $legacy;
@@ -3589,8 +3590,8 @@
for my $mask (0 .. 63) {
if ($capsvector[$mask] =~ /^(\+?)U\+([0-9a-fA-F]+)$/) {
my $v = hex ($2);
- my $l = ord (lc (chr ($v)));
- my $u = ord (uc (chr ($v)));
+ my $l = ord (lc (pack ("U", $v)));
+ my $u = ord (uc (pack ("U", $v)));
my $c = ($v == $l ? $u : $l);
$capsvector[$mask] = $1 ."U+". sprintf ("%04x", $c);
if ($v != $c && $v gt 0x7f) {
Reply to: