1

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 ?

Zanna
  • 72,312
Anne Aunyme
  • 121
  • 5

2 Answers2

1

The problem was solved by the following commands:

sudo update-locale LANGUAGE=fr_FR.UTF-8
sudo update-locale LANG=fr_FR.UTF-8
Zanna
  • 72,312
Anne Aunyme
  • 121
  • 5
1

You need to get rid of those locale errors too by generating the fr_FR.UTF-8 locale:

sudo locale-gen fr_FR.UTF-8