Unicode in the command line
Posted by isilanes on November 20, 2007
This is a short HowTo for making unicode work in Linux, specifically in the command line. Yet more specifically, in the konsole terminal. This is useful if you want to be able to use characters like ‘ñ’ or accents like in ‘á’ and ‘ö’.
1 – Modify your shell locale variables
You need locale settings that support UTF (for example en_US.UTF-8). For that, you can add the following lines to .tcshrc or whatever script run at login:
setenv mylang en_US.UTF-8 setenv LANG $mylang setenv LC_CTYPE $mylang setenv LANGUAGE $mylang setenv LC_ALL $mylang
The ‘$mylang’ thing is just because I’m lazy, and I might want to change them all in the future, and I don’t want to type too much.
2 – Modify your global locales
I don’t know if this is needed, but it doesn’t hurt. In Debian:
% dpkg-reconfigure locales
and follow the instructions, using en_US.UTF-8 or something similar as default.
3 – Modify the encoding of Konsole
In the menus:
Make this permanent with:
Settings->Save as Default
Then choose xterm and not linux as keyboard setting:
Settings->Keyboard->Xterm (XFree 4.x.x)
You can make this permanent in the Session tab of:
namely inserting “xterm” in the box labeled “$TERM”.
If you follow these instructions, you will be able to introduce non-ASCII text in the terminal, and use non-ASCII filenames without problem.
This entry was posted on November 20, 2007 at 8:35 pm and is filed under Free software and related beasts. Tagged: en, floss/linux, howto, Software, unicode, utf-8. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.