Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I will explain my problem from the beginning, I have an Ubuntu server 8.04LTS and I use a Java application with Tomcat 6.0.18 and JRE 1.6. The problem is that the display of characters such as (é è ç û) is replaced by other strange characters. I know this is a problem of character encoding so I try to add the encoding fr_FR.ISO-8859-1 in the bashrc file and /etc/default/locale and I added LANG="fr_FR.ISO-8859-1". I successfully display the good characters from a remote console (PuTTY) but the same problem still occurs when typing directly on the shell server.

For example, when I mkdir a folder called "Août" I receive "Ao♦t".

I think this may be due to the encoding used by the system partition, but I do not know how I can verify this.

Does anyone have an idea how I can fix this?

share|improve this question

2 Answers 2

UPDATE: perhaps this is stating the obvious, but you must use either ISO-8859-1 or UTF-8 consistently everywhere, in both the system-wide settings (/etc/default/locale) and (if required) in the application's Java settings.

You need to change the system-wide locale to use ISO-8859-1 - however it would be much cleaner, if the application supports UTF-8, to simply have it use that (via -Dfile.encoding=utf8 on the JVM), as Ubuntu now works by default in UTF-8.

Check your application's documentation to see how to set the locale and encoding (e.g. ISO-8859-1) - if this isn't covered, setting the JAVA_TOOL_OPTIONS environment variable may be useful- this could be in the application's startup script.

To set Ubuntu to use ISO-8859-1:

  • Generate the required Linux locale in case it doesn't exist already, and update /etc/default/locale via update-locale:
sudo locale-gen fr_FR
sudo update-locale LANG=fr_FR.ISO-8859-1
  • UPDATE: Make similar edit to /etc/environment
    • not sure why Ubuntu requires this but it's on my 8.04 system which was clean install not upgrade
  • Close all applications and shell sessions, and restart them.

Unlike Windows and Mac, file systems on Linux have no concept of character encoding, so the application can generate files with ISO-8859-1 or UTF-8 pathnames at will, and even mix them in the same directory. That's why you can create a directory as "Août" and have it display wrongly in another shell.

Using env | egrep "^(LC|LANG)" can be useful to check the locale variable settings - it sounds like those for your local shell (xterm, GNOME Terminal, etc) are wrong. Once you have the right settings, put them into your ~/.bashrc file for the shell.

If you have folders created that have the wrong encodings in the pathnames, have a look at convmv - it's in the Ubuntu repositories.

Some general info on setting up locales and character encodings in this Gentoo UTF-8 HOWTO - although this is not for Ubuntu so some commands differ, the locale command is the same and the ideas are explained quite well.

share|improve this answer
thaks RichVel for helping me before changing any thing this is my /etc/default/locale file LANG=fr_FR.ISO-8859-1 i also added this line to my bashrc file as root export LANG="fr_FR.ISO-8859-1" and when runing env | egrep "^(LC|LANG)" i get this result LANG=fr_FR.ISO-8859-1 LANGUAGE=fr_FR:fr –  ME-KJ May 4 '11 at 15:26

Try defining LC_ALL the same way.

Also if you're using an xterm when seeing this locally try starting it with the -U parameter.

If you're having problems on Tomcat, though, you should probably be setting -Dfile.encoding=utf8 or -Dfile.encoding=iso8859-1 as JVM parameters instead. Perhaps you also need -Duser.region=fr?

share|improve this answer
thank you eduardo obviously my problem is with tomcat but mostly I found it a problem in the system too, when typing directly on the server shell the command (date -d "3 months") i get Ao♦t instead of Aoû, i tried starting tomcat with editing catalina.sh file adding this line (CATALINA_OPTS="$CATALINA_OPTS -Xmx1024M -XX:MaxPermSize=1024M -DFile.encoding=UTF8 -Duser.region=fr") but always the same reseult just a question how can i modify LC_ALL –  ME-KJ May 4 '11 at 14:51
To change LC_ALL, just edit /etc/default/locale, copy the line containing LANG, and create a new one looking something like this: LC_ALL=fr_FR.ISO-8859-1. If you are now trying to have the application work in UTF-8 mode, you will need to set all the locale variables to fr_FR.ISO-8859-1 - but setting LANG and LC_ALL should be enough (usually just LANG is enough). –  RichVel May 5 '11 at 5:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.