﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
2722	Mistake on the linux console page	splotz90	Matthew Burgess	"The book says:

""'''''In UTF-8 mode, the kernel uses the application character map for conversion of composed 8-bit key codes in the keymap to UTF-8, and thus the argument of the ""-m"" parameter should be set to the encoding of the composed key codes in the keymap.'''''""

That's wrong. The man page of setfont says:

""'''''If the console is in utf8 mode (see unicode_start(1)) then the kernel expects that user program output is coded as UTF-8 (see utf-8(7)), and converts that to Unicode (ucs2). Otherwise, a translation table is used from the 8-bit program output  to 16-bit Unicode values. Such a translation table is called a Unicode console map.'''''""

The console internal always uses unicode (regardless if we're using the unicode mode or not): http://www.mjmwired.net/kernel/Documentation/unicode.txt

So this table is used to convert the output of programs, that are using ""legacy charsets"", to unicode. It '''doesn't''' convert the the key codes in the keymap. It also converts the input from the keyboard. Example:

'''''program (8859-1 output) --> unicode console map (unicode output) --> font --> character on screen'''''

and:

'''''keyboard --> scancode --> kernel keymap (unicode output) --> unicode console map (8859-1 output) --> program'''''

This conversion only takes place, if we're '''NOT''' in unicode mode. I've tested all these things ...

----

Some comments on the examples in the book:

{{{
cat > /etc/sysconfig/console << ""EOF""
# Begin /etc/sysconfig/console

KEYMAP=""de-latin1""
KEYMAP_CORRECTIONS=""euro2""
FONT=""lat0-16 -m 8859-15""

# End /etc/sysconfig/console
EOF
}}}

'''''KEYMAP_CORRECTIONS=""euro2""''''' is not necessary because de-latin1 already includes euro2.map
[[BR]]


{{{
cat > /etc/sysconfig/console << ""EOF""
# Begin /etc/sysconfig/console

UNICODE=""1""
KEYMAP=""de-latin1""
KEYMAP_CORRECTIONS=""euro2""
LEGACY_CHARSET=""iso-8859-15""
FONT=""LatArCyrHeb-16 -m 8859-15""

# End /etc/sysconfig/console
EOF
}}}

'''''KEYMAP_CORRECTIONS=""euro2""''''' is not necessary because de-latin1 already includes euro2.map[[BR]]

'''''FONT=""LatArCyrHeb-16 -m 8859-15""''''' --> ""'''''-m 8859-15'''''"" is not meaningful because the kernel doesn't use this translation table in unicode mode.

'''''LEGACY_CHARSET=""iso-8859-15""''''' is not necessary because the de-latin1 keymap doesn't contain any charset specific character code values. The symbolic values will be converted into unicode in the right way (without help of this conversion). See src/ksyms.c in the kbd source.

The dumpkeys man page says:

'''''-ccharset --charset=charset
This instructs dumpkeys to interpret character code values according to the specified character set. This affects only the translation of character code values to symbolic names. Valid values for charset currently are iso-8859-X, Where X is a digit in 1-9. If no charset is specified, iso-8859-1 is used as a default. This option produces an output line 'charset ""iso-8859-X""', telling loadkeys how to interpret the keymap. (For example, ""division"" is 0xf7 in iso-8859-1 but 0xba in iso-8859-8.)'''''

----

I suggest that we're adding the following examples for a german LFS into the book:

For a system with programs that uses ""legacy charsets"":


{{{
cat > /etc/sysconfig/console << ""EOF""
# Begin /etc/sysconfig/console

KEYMAP=""de-latin1""
FONT=""lat0-16 -m 8859-15""

# End /etc/sysconfig/console
EOF
}}}

For a system with no ""legacy software"" (only UTF-8 compatible programs):


{{{
cat > /etc/sysconfig/console << ""EOF""
# Begin /etc/sysconfig/console

UNICODE=""1""
KEYMAP=""de-latin1""
FONT=""lat0-16""

# End /etc/sysconfig/console
EOF
}}}

It should be pointed out that the ""-m $charset"" option is only meaningful if ""legacy software"" with old charsets needs to be supported.

----

Finally, some references:

http://linux.die.net/man/1/dumpkeys

http://linux.die.net/man/8/setfont

http://www.mjmwired.net/kernel/Documentation/unicode.txt

http://gunnarwrobel.de/wiki/Linux-and-the-keyboard.html

http://freeworld.thc.org/papers/writing-linux-kernel-keylogger.txt"	task	closed	normal	6.8	Book	SVN	normal	wontfix		
