You are not logged in.

#1 2010-01-17 18:41:37

pguertin
Member
Registered: 2010-01-14
Posts: 2

[SOLVED] Dead keys on console in UTF-8 locale

Hello,

I want to share something interesting I found out about dead keys support on the Linux console (i.e., without X).

I live in Canada and use the "Canadian French" keyboard, which uses dead keys for several diacritical marks (e.g., to type ê I push and release the ^ key, then type the e key). It works perfectly under X, but I was unable to type any character using dead keys on the console. On the other hand, non-ASCII characters like "é" that do not use dead keys worked perfectly.

After some googling, I found many posts claiming the kernel did not support dead keys when the console was in Unicode mode. So I changed the locale to a non-UTF-8 setting in /etc/rc.conf, and indeed dead keys started working. But this was not useful to me, since editing UTF-8 files resulted in gibberish, and I did not want to regress back to Latin1 encoding or have to support both encodings. I tried many combinations of settings, but none worked. For a few days, I thought there was no way to have dead keys and Unicode working on the Console.

But then I started to install Arch Linux on another computer and noticed that when I set the keyboard to Canadian French with the "km" utility before installing (the keymap is called "cf"), dead keys worked, even though the locale was Unicode! So there was a way to do it.

I started digging and trying new things, and found out that after the following incantations, I was able to enable dead keys for Unicode on the console:

kbd_mode -a
sudo loadkeys cf
kbd_mode -u

This sets the console to ASCII mode, loads the "cf" keymap, and sets the console back to Unicode. I found it by trial and error, and I have no idea why it works or whether it breaks anything. I'm posting here to ask if there are easier ways to have a functional Canadian French keyboard on the console, and to document what I did in case someone has a similar problem.

Last edited by pguertin (2010-01-23 21:44:33)

Offline

#2 2010-01-23 21:41:25

pguertin
Member
Registered: 2010-01-14
Posts: 2

Re: [SOLVED] Dead keys on console in UTF-8 locale

pguertin wrote:

Hello,
I live in Canada and use the "Canadian French" keyboard, which uses dead keys for several diacritical marks (e.g., to type ê I push and release the ^ key, then type the e key). It works perfectly under X, but I was unable to type any character using dead keys on the console. On the other hand, non-ASCII characters like "é" that do not use dead keys worked perfectly.

After some more experiments, I found that the culprit was the line

compose as usual for "iso-8859-1"

that can be found near the beginning of the cf.map.gz keymap file. The file probably dates from when the console used iso-8859-1, not utf-8.

I copied cf.map.gz to a new cf2.map.gz file, removed the "compose as usual" line and added my own compose statements such as

compose '`' 'a' to agrave

at the end of the file, and now dead keys work on the console again. Yay.

Offline

#3 2010-01-25 06:50:25

mordoror
Member
Registered: 2010-01-25
Posts: 4

Re: [SOLVED] Dead keys on console in UTF-8 locale

I have the exact same issue.

The weird thing for me is that before I was using gentoo and never had a problem with dead keys and unicode. Also, I confirm that dead keys is working when booting from the archlinux installation cd. Either run 'loadkeys cf' rigth after login or pass 'keymap=cf' as a boot parameter to the kernel line by editing it in grub before booting.

Your solution is interesting, however the cf.map.gz file is the same on the installation cd (and on my gentoo system) so it should works without editing it.

In my quest to solve this issue, I found something interesting. I added the 'keymap' hook in /etc/mkinitcpio.conf and regenerated the image by issuing

mkinitcpio -g /boot/kernel26.img

This alone didn't solved the issue, but then I REMOVED the keymap assignation in /etc/rc.conf (i.e. leaving it as

KEYMAP=

), rebooted... and voilà, it now works.

Furthermore, now if I run

sudo loadkeys cf

after login it stops working (well of course because it's the same as defining KEYMAP="cf" in /etc/rc.conf). Issuing the 3 commands of your first post make it works again. OK so I did one more test: boot from the archlinux installation cd by adding the 'keymap=cf' boot parameter to the kernel line and then run 'loadkeys cf' after login to see if it breaks dead keys. But no, it still works.

So is this issue comes from a newer version of the kernel/loadkeys/mkinitcpio/...? How different is the kernel and initramfs images of the installation cd compared to the installed system ?

Offline

Board footer

Powered by FluxBB