Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

on a machine I have access to, when I type "€" in vi, "~B� " is displayed instead, and when I type "£", "£ " What can cause this strange behavior, how can I fix it? Typing it in the console gives even less results.

locale output :

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Inside vim (I explicitely tried using vim with an 'm'):

:set enc

This looks very wrong...

Typing :set encoding=utf-8 solves the problem, but how can I make my system use utf-8 everywhere? The problem I'm trying to solve is the fact that a fixture file for my database seems to be interpreted as latin1 by php...

share|improve this question
You should fix your locales. IIRC dpkg-reconfigure locales should do it. – enzotib Sep 19 '11 at 14:10
@enzotib : I'll try to have the admin do this, thanks! – greg0ire Sep 19 '11 at 14:24
up vote 3 down vote accepted

As enzotib said, you need to reconfigure your locales. Run DEBCONF_PRIORITY=low sudo dpkg-reconfigure locales.

  • Make sure that you enable en_US.UTF-8 in the first question.
  • Make sure that you set en_US.UTF-8 as the default locale in the second question.
share|improve this answer
This will be tried as soon as I can get someone with root privileges to do it. – greg0ire Sep 19 '11 at 14:27
Before I connected through ssh, my LC_CTYPE variable was set to fr_FR.UTF-8 . I think this must somehow act on the default locale – greg0ire Sep 26 '11 at 16:26

If your vi is vim, then you must take care of your locales and the settings of enconding inside vim:

First question: Which locale do you use?

echo $LC_ALL

My shell prints de_DE.utf8

Second Question: Is it the same locale used in vim? (Inside vim session)

:set enc

My vim prints encoding=utf-8


share|improve this answer
I tried what you said and more and updated my answer. locale outputs two errors. +1 – greg0ire Sep 19 '11 at 12:03

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.