Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question
2  
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

2 Answers 2

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

HTH

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

 
discard

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.