I am using a server (by ssh) and as I am French I would like to be able to use characters such as "à", "ç" and "é". However they simply can't be printed in the standard output, whether when I press the corresponding key on my keyboard (it simply ignores the key), or when I run a script supposed to print them. For example a Python script will raise:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-3: ordinal not in range(128)
Following some advices I looked at the locale:
$ locale
LANG=C
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
So I opened the /etc/default/locale file, and changed it from:
LANG="C"
to
LANG=fr_FR.UTF-8
It still doesn't work, but a call to locale now tells me:
$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=fr_FR.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=
Any ideas how I could fix this ?
sudo update-locale LANGUAGE=fr_FR:fr
?update-locale
updates/etc/default/locale
for you (that's what it's supposed to do anyway. You can edit it yourself instead though.)LANGUAGE=fr_FR.UTF-8
,LANG=fr_FR.UTF-8
and the problem seems to be fixed. @FlorianDiesch: your link seems to be a similar problem but not exactly the same.