[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ A ] [ next ]

Debian Euro HOWTO
Chapter 3 - Configuring euro support


3.1 Initial considerations

Configuring euro support in a system involves two steps, which should be pretty simple:

The recommended mechanism in the euro zone for the euro symbol generation on modern keyboards is the AltGr+e combination for the euro currency and AltGr+c for the cent. Note: Laptop users might not have AltGr.

This document will approach the euro configuration in Debian taking a look, first, towards localisation issues, and how localisation can be properly configured in Debian. Afterwards, it will go into how to configure the console (virtual terminals) available in all Debian GNU/Linux systems. Many users might want to skip this section and go directly to the next section, which discusses the proper configuration of the graphic environment (X windows) for euro support.

Even if it might sometimes confuse the reader, the different configuration issues are discussed both for the old Debian release (as of this writing Debian 2.2 codename 'potato') and the latest Debian release (Debian 3.0 codename 'woody'). Future versions of this document might separate the information regarding different Debian versions (when it really gets messy :)


3.2 Localisation issues

Programs use the localisation environment in order to know both the language and the charset being used. Currently there is no separation, unless you are using UTF-8 from locale and representation. Environment locales use both the language for example:

     es_ES.ISO-8859-1
     en_US.utf
     ....

Locale definitions are stored in Debian at /etc/locale.alias for the libc library and /usr/X11R6/lib/X11/locale/locale.alias. In order to indicate which charset you are using, you need to set your LANG environment variable. One of the ways of doing this is changing /etc/environment or /etc/profile.

However, there is a problem due to the different representation of locales in XFree86 (Xlib) and glibc (one uses ISO8859 and the other ISO-8859, note the dash). Thus, setting the locale to XX_XX.ISO-8859-15 in /etc/environment is doomed to cause problems in the X environment (might not be recognised or generate errors in applications).

Since Debian 3.0, the XX_XX@euro alias is provided in the /usr/X11R6/lib/X11/locale/locale.alias and in the /etc/locale.alias, users that wish to setup their locale environment should use this abbreviation instead of the previous XX_XX@ISO-...

You can see your current environment running locale, and your current map character using locale charmap. In order to change your locale edit /etc/environment or /etc/profile and add (the example is for Spanish, change as needed):

     export LANG=es_ES@euro
     export LC_ALL=es_ES@euro

Note: You must use the @euro part. Otherwise, if you just use es_ES the locale definition will be that of the ISO-8859-1 charset.

Please, note that the LANG and LC_ALL definitions should be similar (or even better the same). Otherwise libraries might warn against incompatible locale. You will see warnings if, for example, you set:

     export LANG=spanish
     export LC_ALL=es_ES@euro

since 'spanish' is aliased to es_ES.ISO-8859-1 and es_ES@euro is alised to es_ES.ISO-8859-15. Be careful with this issue since some programs do not check the locale.aliases file and use hardcoded value for them. It is not recommended to change the locale.alias to have, for example, 'spanish' aliased to es_ES.ISO-8859-15 since programs that use these method will not properly work. If your favorite software does not work with the 'XX_XX@euro' please file a bug against it.

You can check all the available locales by running locale -a

For programs that give too many warnings much because of localisation/representation issues with stuff similar to

     Gdk-WARNING **: locale not supported by C library

or

     Warning: locale not supported by C library, locale unchanged

use LANG=XX_XX.ISO-8859-1 program& to run them and avoid the errors/warnings. In any case, check that you have properly set your locale and, if so, file a bug against the offending package.

In order for your X environment to work there should be a definition of the iso8859-15 definition at /usr/X11R6/lib/X11/locale. If you do not have properly configured locales, X might warn about this (before it runs any program). Please check your ~/.xsession-errors file since this might be happening without the user noticing in modern desktop enviroments (all errors are directed there and not to the screen). A sample warning would be:

     Warning: locale not supported by Xlib, locale set to C

3.2.1 Locales in Debian 3.0

In order for your locales to work in 3.0 the administrator has to configure properly the system's localization. The easiest way to make this modifications is to call dpkg-reconfigure -plow locales, and choose your locale in the version with an @euro appended.

You can also edit /etc/locale.gen directly, inserting there the euro locales definitions and run locale-gen. If your locales are already defined there but appended with a '#' sign, uncomment (remove that sign) the lines needed for the users' locale. Mainly the XX_XX.ISO-8859-15 lines and the XX_XX@euro lines and run locale-gen. This should create /usr/lib/locale/XX_XX@euro.


3.2.2 Locales in Debian 2.2

You cannot edit /etc/locale.gen if you are using Debian 2.2 since it does not exist. But, in any case, you do not need to do it since all the locales are included in Debian as default. However, Debian 2.2 locales (version 2.1.3-13) does not provide the euro definition. If an upgrade to woody's (3.0) locale is not possible (this upgrade will most probably change the libc version), you will need to make the changes manually.

In Debian 2.2, users need to change some files (these changes are unnecessary in 3.0 since they already have been made). Supposing an Spanish environment (es_ES locale), the change for /etc/locale.alias is:

     es_ES@euro	es_ES.ISO-8859-15

and for /usr/X11R6/lib/X11/locale/locale.alias is:

     es_ES@euro	es_ES.ISO8859-15

After doing this you have to generate your locales You can do so running localedef manually. Charmapfiles are found in /usr/share/i18n/charmaps, inputfiles can be found in /usr/share/i18n/locales. In order to create, for instance, a en_US.ISO-8859-15 locale, you'd do this:

     $ localedef --force -i /usr/share/i18n/locales/en_US \
                -f /usr/share/i18n/charmaps/ISO-8859-15 \
                 en_US.ISO-8859-15

You can usually also use a simplified version since localedef should be able to find the charpmaps and locales on its own:

     $ localedef --force -v -i en_US -f ISO-8859-15 en_US.ISO-8859-15

The directory created is named /usr/share/locale/en_US.iso885915. You also have to create the en_US.ISO-8859-15 directory, do so by symlinking it to the previous one.

     $ cd /usr/share/locale
     $ ln -s en_US.ISO-8859-15 en_US.iso885915

3.3 Configuring the Console

Configuring the text console in order to have the euro symbol ready is simple. The following will work in a Debian GNU/Linux system:

     $ loadkeys euro.inc
     $ consolechars -f lat0-16.psf

However, this changes are lost after reboot. In order to make them permanent, some changes need to be done to the configuration files of Debian packages.


3.3.1 Configuring the console keyboard

Changing the key mappings involves changing /etc/console-tools/default.map.gz or /etc/kbd/default.map.gz. Usually, this keymap is changed by using kbdconfig (if you are not using console-tools see below for the different console keyboard schemes in Debian), since it is loaded before any network filesystem is mounted, you cannot change it directly (for example by adding include euro there) as it might not be able to load extensions (since they are located at /usr/share/keymaps). In order to have euro support, if your keymap currently does not have one you will have to modify an existing one. Here is an example on how to change the Spanish keymap to support euro characters (kbdconfig will ask some questions, only the answers are shown below):

     $ cd /usr/share/keymaps/i386/qwerty
     $ cp es.kmap.gz es-euro.kmap.gz
     $ gzip -d es-euro.kmap.gz
     $ echo "include \"euro\"" >>es-euro.kmap
     $ echo "altgr keycode  46 = cent" >>es-euro.kmap
     $ gzip es-euro.kmap
     $ kbdconfig
     -----ANSWERS:
     n
     i386
     qwerty
     es-euro
     y
     y
     $ zgrep "keycode  18" /etc/console-tools/default.kmap.gz
     keycode  18 = +e                +E                currency         Control_e
         Control_e        Meta_e           Meta_E           Meta_Control_e

FIXME: A bug should be opened against console-data in order to include this by default in all the euro-zone language maps.


3.3.2 How the keyboard is loaded in Debian

The console-common in Debian 3.0 installs /etc/init.d/keymap.sh which runs loadkeys of console-tools (using /etc/console-tools/default.map.gz) or kbd (using /etc/console/boottime.kmap.gz). This file has been generated using /usr/sbin/install-keymap.

When a system boots up it runs /etc/rcS.d/S05keymap.sh (for kbd) or /etc/rcS.d/S05keymap-lct.sh (for console-tools) which installs the appropriate keymap. Both scripts will make either /etc/init.d/keymap.sh or /etc/init.d/S05keymap-lct.sh being called with the 'start' option.


3.3.3 Configuring the console fonts

The easy way to configure a console in a Debian system is to install the fonty provided since Debian 2.2 and tell it to use iso15 fonts (fonty currently does not support iso-8859-16 yet, however). These fonts will include the euro character and the package will configure properly the configuration files needed. You will need, however, to configure the keyboard mappings, as describe previously.

If you do not want (or like) the fonty font, you can configure the console fonts yourself. In order for the fonts to be loaded automatically when the system is started, you (as superuser) have to change some of the configuration files.

If the system is using the console-tools package, then the /etc/console-tools/config file will be present. In order to load the appropriate font you need to include the line:

     SCREEN_FONT=lat0-16
     APP_CHARSET_MAP=iso15

If you are using multiple virtual terminales you might want to add this:

     APP_CHARSET_MAP_vc1=iso15
     APP_CHARSET_MAP_vc2=iso15
     APP_CHARSET_MAP_vc3=iso15
     APP_CHARSET_MAP_vc4=iso15
     APP_CHARSET_MAP_vc5=iso15
     APP_CHARSET_MAP_vc6=iso15

If you are using the kbd package you will need to edit the /etc/kbd/config adding, for example:

     CONSOLE_FONT=lat0-16.psfu.gz
     # CONSOLE_MAP=iso15
     CONSOLE_MAP=8859-15_to_uni

Of course, the lat0-16 font is not the only one available, since the console-data package version 1999.08.29-11.1, there are quite a number of latin9 (aka. latin0) fonts available at /usr/share/consolefonts. Some other people prefer the lat0-sun16 font, it's just a matter of taste.

If you are using the svgatextmode package (obsoleted by the framebuffer) you might configure the console font also by changing the /etc/TextConfig file.

NOTE: If you are using the framebuffer device for console text, read the note regarding console-tools configuration in the /etc/console-tools/config file. Basically, the global definition will only work for the first virtual terminal, you need to explicitly state the font for the other terminals like this:

     SCREEN_FONT_vc1=lat0-16
     SCREEN_FONT_vc2=lat0-16
     SCREEN_FONT_vc3=lat0-16
     ....

3.4 Configuring the X environment

For the graphic environment to represent euros you also need to have:

XFree86 includes euro-ready fonts since version 3.3.3.1, like, for example 7x13euro.bdf or 7x13euroB.bdf. However, the user might not have them installed since ISO-8859-15 fonts are not part of the default (basic) XFree86 installation.

Also, Debian 3.0 provides proper keyboard configuration for most languages. However, some languages do not provide full euro support due to the keycode not being properly defined. If your language does not behave properly in X, please submit a wishlist bug against the xlibs package (known related bugs include #117185, #127609 and #139826)


3.4.1 Keyboard configuration

The keyboard configuration here is easier that in console. If you are using the Xkb extensions in the X server (the default since 3.3.5) you can change it using the XkbLayout option in the InputDevice section of the X configuration file. That file is located in /etc/X11/XF86Config for XFree86 3.3.6 and /etc/X11/XF86Config-4 for XFree86 4.1.

There are several ways you can add support for the euro definition:

If you change the modmap with xmodmap and it works, it's a temporary fix, after restarting the server the changes will get lost. In order to have this definition loaded on startup you have to add the following definition to your Xmodmap by doing:

     $ xmodmap -pke > ~/.xmodmap

NOTE: Xmodmap is obsolete, please use the Xkb extensions. Future releases of XFree86 might not even support user's defined xmodmaps.

NOTE: the locales setting must be done before Xsession starts, so make sure that your configuration is loaded properly before executing startx (if you are using an XDM application such as gdm you can choose the settings from it).

NOTE: The symbol used for the Euro sign varies from Xfree 3.3.6 (standard X server in Debian 2.2) to Xfree 4.1 (standard X server in Debian 3.0). In Xfree 3.3.6 you will have to use "currency" instead of "EuroSign" as the symbol definition. This has changed in Xfree 4.1 which has built-in support for the EuroSign character. If you use currency that same symbol in Xfree 4.1, due to UTF support, it might not represent properly the Euro character.


3.4.1.1 Xfree in Debian 3.0

If you are using Debian woody (3.0), which includes XFree86 4.1, you only need to have it properly configured to a language in the euro zone, this is done in the configuration file /etc/X11/XF86Config-4. Inputting the euro symbol should work correctly (if not, please file a bug).

You can also make some changes to provide euro support if your system does not work properly. You can change the Xkb extensions (at the files in /etc/X11/xkb/symbols) to include Euro support with something along the lines of:

       key <AD03> {        [                 e,    E               ],
                           [        EuroSign,      cent        ]       };

This, however, should already be provided in all the files of languages from the Euro zone (es, de...)

Or, you can change your Xmodmap definition with:

     $ echo "keycode 0x1A = e  E EuroSign cent" | xmodmap -

If you are not using Xkb extensions you will have to change the definitions available at the /usr/share/xmodmap/ directory (the file name is xmodmap.XXX with XXX the one appropriate to your language).

Since Xkb extensions is the default behavior the Xmodmap files provided by Xfree86 4.1 might not be updated properly. Check that the line related to the keycode 26 (E character) looks like the following line:

     keycode  26 = e E EuroSign cent

3.4.1.2 Xfree in Debian 2.2

If you are using versions equal to, or prior to Debian potato (2.2), the language definition might not be properly defined. If an upgrade to a newer version of XFree86 is not possible, you can use any of the previous approaches to add support for the euro definition:

You can change the Xkb extensions (/etc/X11/xkb/symbols) to include currency support with something along the lines of

       key <AD03> {        [                 e,    E               ],
                           [        currency,      cent        ]       };

Or, you can change your Xmodmap definition with:

     $ echo "keycode 0x1A = e  E currency cent" | xmodmap -

You can also use the definitions available at the /usr/share/xmodmap/ directory (change the file appropriate to your language) if you are not using Xkb extensions. Check that the line related to the keycode 26 (E character) looks like the following line:

     keycode  26 = e E currency cent

Debian 2.2 Xmodmap definitions of the languages in the euro zone contain the euro character (using the currency symbol), so you can use the following xmodmap /usr/share/xmodmap/xmodmap.XX (XX is the language you want to use).


3.4.2 Font configuration

In order to represent the euro symbol in X you need to have appropriate fonts to represent the ISO-8859-15 encoding (if not using UTF-8). You can see which fonts could be used for this by doing:

     $ xlsfonts | grep 'iso8859-15$'

In a default Debian installation, the only font that provides this encoding is the fixed (misc) font, which might be proper for an xterm but might not show up nice in many other applications. However, Debian 3.0 (woody) provides the transcoded package fonts which include other ISO-8859-15 fonts. The packages are xfonts-base-transcoded, xfonts-75dpi-transcoded, xfonts-100dpi-transcoded, and you can install them by running apt-get install 'xfonts.*transcoded'.

Some people might not want to install these packages because they are quite large, around 15 Mb. There is a hacked version available, with all non-15 fonts removed which is less than 3Mb in size. You can find it at http://sites.inka.de/W1752/reduced-xfonts/. Note that this is not part of the standard Debian distribution.

(FIXME if users really need this the transcoded packages should be broken in two.)


3.4.2.1 Potato, XFree86 3.X

Please note that if you are using Debian 2.2 you cannot install these packages without a system upgrade since they depend on XFree86 4.

The following packages also provide ISO-8859-15 fonts: xfonts-jmk, xfonts-arphic-bsmi00lp, xfonts-arphic-gbsn00lp, xfonts-arphic-bkai00mp and xfonts-arphic-gkai00mp.

The xfonts-cyrillic package provides also (in the XFree86 3.3.6) some ISO-8859-15 fonts.

FIXME: Verify this last statement (seems to due to the data sent to me from users of the euro-test program)

NOTE: Be sure you do not have a default definition for another font in your .Xdefaults file. For example with

     *VT100.font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-16

If you cannot find any suitable fonts, you can use the ISO10646-1 fonts which are a superset of the different ISO8859-X fonts and are also provided in Debian. Markus Kuhn provides a script called ucs2any.pl which states:

             This Perl script allows you to generate from an ISO10646-1 encoded
             BDF font other BDF fonts in any possible encoding. This way, you can
             derive from a single ISO10646-1 master font a whole set of 8-bit
             fonts in all ISO 8859 and various other encodings.

There are Unicode fonts for X-windows available at http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html. In ucs-fonts.tar.gz and ucs-fonts-75dpi100dpi.tar.gz there are Times, Helvetica, Lucida, Utopia, New Century, Schoolbook, Courier... fonts that can be used. You can also use the yudit program to change these fonts.

There are Debian packages available to install the Kuhn's unicode fonts. FIXME: What are the names for them?

There are other useful XFree86 3.3.6 ISO-8859-15 fonts at http://linux.ee/~ville/vh-fonts-0.99.2.tar.gz, even if provided mostly for Estonian users they are correct fonts and include modified helvetica, times, courier and one font for terminal.


[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ A ] [ next ]

Debian Euro HOWTO


version 1.2, june 4th 2003.

Javier Fernández-Sanguino Peña [email protected]