Character encoding de_DE on Linux Debian

On my debian server today I run into a problem with the encoding of XSL templates running on a GlassFish server. The problem was that German characters where not displayed correctly.

After a long time of searching, I figured out that the reason for that problem was not my MySQL database, nor my GlassFish installation. It was simply the missing German language support on my linux debian.

You can test the installed locales with the following command:

locale -a

In my case only ‘en_US.utf8’ was listed.

In debian you can simply add the german language support by changing the file /etc/locale.gen. Simply uncomment the lines:

de_DE ISO-8859-1
de_DE.UTF-8 UTF-8
de_DE@euro ISO-8859-15

and run the command:

locale-gen

After restarting my GlassFish server the xsl transformation works fine with german characters.

The command “locale -a” now displays the following locale:

C
de_DE
de_DE@euro
de_DE.iso88591
de_DE.iso885915@euro
de_DE.utf8
deutsch
en_US.utf8
german
POSIX