Author: Daniel Deimert
Email: d1dd@dtek.chalmers.se
Web Page: http://www.dtek.chalmers.se/~d1dd/
Date Submitted: Wed, Mar 18, 1998
Status: Updated Entry
Entry Updated: 8

Releases: 5.0
Platform: all
Category:  Installing Issues
Category Listing:  How do I enable my [Swedish] national characters in Red Hat Linux 5.0

Issue

Someone told me to set "LC_CTYPE=iso_8859_1" to make Swedish characters 
work in Linux. But it doesn't! How do I make them work? 

Response


This solution applies to all national characters, though the example will enable Swedish national characters. It should be easy enough to substitue your own country data.

Red Hat Linux 5.0 uses glibc, which has "locale" support. The locale support is what you use to enable your national characters and other "local features" like currency format. Unfortunately, glibc as shipped with redhat does not come with pre-compiled locales, so you must compile them yourself. This is easy.

STEP 1: Select a Swedish keyboard

At installation time, you were asked to select your keyboard. In case you didn't know what to choose, rerun /usr/sbin/kbdconfig and select "se-latin1".

STEP 2: Compile the locale

[root@localhost /usr]# cd /usr/share/i18n
[root@localhost i18n]# localedef -c -f charmaps/ISO-8859-1 -i locales/sv_SE sv_S E.iso-8859-1

STEP 3: Enable the locale

Edit /etc/profile with your favourite editor and add export LC_CTYPE=swedish If you prefer to have date, time and system messages in Swedish as well, you can add LC_ALL=swedish.

STEP 4: GNU readline

To enable the national characters to be entered in the bash shell, add

set output-meta on
set convert-meta off

to the ~/.inputrc file in your home directory. (You can put this file in the /etc/skel directory if you want all *new* users to have these settings by default.)

STEP 5: GNU emacs

To enable the national characters to be viewed in emacs, add

(standard-display-european 1)

to the /usr/share/emacs/site-lisp/site-start.el file. This will apply to all users of your system.

STEP 6: the X Window system

The normal configuration of the X Window System should allow you to select a Swedish keyboard, but in case you didn't choose it, make sure the following lines goes into the "Keyboard" section:

Xkbkeycodes "xfree86"
XkbTypes "default"! !
XkbCompat "default"
Xkb Symbols "en_US(pc101)+se"
XkbGeometry "pc"

DONE.

The settings will take effect the next time you login.

References

man 7 locale; man -k locale