Purpose of this HOWTO is to show how to setup properly Pure [ISO] and Virtual [UTF] Terminals with
syscons + xterm + urxvt + screen with English Language for manuals, commands and so, but withcorrectly displaing localized characters.
This example is based on polish language/characters, but may also be used with any other language, just change pl_PL.ISO8895-2 to You proper encoding.
Result of properly set localization [these characters are displayed and typed correctly]:
ę ó ą ś ł ż ź ć ń
We have to face little conflict, ISO under Pure Terminal and UTF8 under Virtual Terminal.
PURE TERMINAL // en_US.ISO-8859-1Pure text terminal localization is very clean and easy:
/etc/rc.conf
Code:
# polish terminal settings // choose yours using sysinstall for example
font8x8="iso02-8x8"
font8x14="iso02-8x14"
font8x16="iso02-8x16"
keymap="pl_PL.ISO8859-2"
scrnmap="NO"
/etc/ttys
Code:
# polish virtual terminals // choose yours using sysinstall for example
ttyv0 "/usr/libexec/getty Pc" cons25l2 on secure
ttyv1 "/usr/libexec/getty Pc" cons25l2 on secure
ttyv2 "/usr/libexec/getty Pc" cons25l2 on secure
ttyv3 "/usr/libexec/getty Pc" cons25l2 on secure
PURE TERMINAL + SCREEN // en_US.ISO-8859-1Also screen under pure terminal displays encodings fine but needs also this setting:
/etc/zprofile /etc/profile /etc/csh.login
Code:
LC_ALL=en_US.ISO8859-1
VIRTUAL TERMINAL [X11] +/- SCREEN // en_US.UTF-8
Setting encoding/localizing X11 Virtual Terminal is little enigmatic to me, although I have found a way to have it localized properly. For example I need to export LC_ALL=en_US.UTF-8 in ~/.xinitrc file which is very strange to me.
~/.xinitrc
Code:
export LC_ALL=en_US.UTF-8
exec fluxbox
/etc/zprofile /etc/profile /etc/csh.login
~/.Xdefaults
Code:
urxvt.imLocale: en_US.UTF-8
So we have a problem, we cannot set LC_ALL both to en_US.UTF-8 and to en_US.ISO8859-1 :/ we also cannot use $TERM varible to set our encoding properly, because $TERM will be changed by screen to screen, so this will not work:
/etc/zprofile /etc/profile /etc/csh.login
Code:
case "$TERM" in
cons25*|linux)
export LC_ALL=en_US.ISO8859-1
;;
*rxvt*|*xterm*)
export LC_ALL=en_US.UTF-8
;;
screen)
export LC_ALL=en_US.UTF-8
;;
esac
The sollution is to check for terminal speed [at least it works for me]:
Pure Terminal speed:
Code:
% stty|grep speed
speed 9600 baud;
Virtual Terminal speed:
Code:
% stty|grep speed
speed 38400 baud;
final setup based on terminal speed:
/etc/zprofile /etc/profile /etc/csh.login
Code:
case $( stty | grep speed | cut -d ' ' -f 2 ) in
(9600)
# pure console
export LC_ALL=en_US.ISO8859-1
;;
(38400)
# terminal emulator
export LC_ALL=en_US.UTF-8
;;
esac
these files remain the same as showed upper:/etc/rc.conf
/etc/ttys
~/.Xdefaults
~/.xinitrc
EDIT:
I gorgot to add one of the key files and realized that NOW
keyboard entry in
/etc/X11/xorg.conf must be:
Code:
Section "InputDevice"
Identifier ...
Driver ...
...
Option "XkbModel" "pc105"
Option "XkbLayout" "pl"
EndSection
Of course You will need to change all
export words to
setenv and also remove '=' if You use csh/tcsh shell, but {t}csh users know that