3

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
LANG=en_US.UTF-8
LC_CTYPE=fr_FR.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

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

:set enc
encoding=latin1

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...

2
  • 2
    You should fix your locales. IIRC dpkg-reconfigure locales should do it.
    – enzotib
    Commented Sep 19, 2011 at 14:10
  • @enzotib : I'll try to have the admin do this, thanks!
    – greg0ire
    Commented Sep 19, 2011 at 14:24

2 Answers 2

4

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.
2
  • This will be tried as soon as I can get someone with root privileges to do it.
    – greg0ire
    Commented Sep 19, 2011 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
    Commented Sep 26, 2011 at 16:26
1

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

HTH

1
  • I tried what you said and more and updated my answer. locale outputs two errors. +1
    – greg0ire
    Commented Sep 19, 2011 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .