Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've got a locale problem.
The collating sequence in nautilus and other programs has changed.
I get locale errors appearing in the terminal when I launch a GUI app..

    Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.

The locale command produces error messages

    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_AU
    LANGUAGE=en_AU:en
    LC_CTYPE="en_AU"
    LC_NUMERIC="en_AU"
    LC_TIME="en_AU"
    LC_COLLATE=en_AU.UTF-8
    LC_MONETARY="en_AU"
    LC_MESSAGES=en_AU.UTF-8
    LC_PAPER="en_AU"
    LC_NAME="en_AU"
    LC_ADDRESS="en_AU"
    LC_TELEPHONE="en_AU"
    LC_MEASUREMENT="en_AU"
    LC_IDENTIFICATION="en_AU"
    LC_ALL=

As suggested in askubuntu question, I've run the following commands, but there was no change.

    sudo apt-get install language-pack-en-base
    sudo dpkg-reconfigure locales

I also tried the suggestion in askubuntu question... also no change.

    apt-get install --reinstall locales

I think it began when I temporarily installed and uninstalled the Urdu language Input Method Editor via IBus .. it certainly happened on the same day.

Maybe it is IBus related, but I've not had any problems with it before this.

  • The OS is 10.04
share|improve this question
    
possible duplicate of When I rebooted 12.04, certain menus are in Chinese/Japanese! –  Tachyons Apr 19 '13 at 14:55
add comment

10 Answers

up vote 13 down vote accepted

I've managed to get things running "normally" again.

After trying lots of package re-installs etc, including fully removing IBus (all to no effect), I started to think that it may be caused by a config setting which re-installing doesn't modify.

I had noticed that the output from locale was rather bereft, of UTF-8 assignments, so I checked this in a recently installed VM... all entries of LC_* (except LC_ALL, which overrides all the others) were set with the .UTF-8 suffix. so I manually set the LC_* values as shown below.

I probably could have just used LC_ALL="en_AU.UTF-8", but in reading up about this, I've discovered how to customize the system date and time format, and LC_ALL would override my custom setting.

I don't know if I've used the most appropriate method, but it works!

The modified file is: /etc/default/locale

  • This shows the contents before the mod:

    LANG="en_AU.UTF-8"
    LANGUAGE="en_AU:en"
    LC_MESSAGES="en_AU.UTF-8"
    
  • This shows the contents after the mod:

    LANG="en_AU.UTF-8"
    LANGUAGE="en_AU:en"
    LC_CTYPE="en_AU.UTF-8"
    LC_NUMERIC="en_AU.UTF-8"
    LC_TIME="en_AU.UTF-8"
    LC_COLLATE=en_AU.UTF-8
    LC_MONETARY="en_AU.UTF-8"
    LC_MESSAGES=en_AU.UTF-8
    LC_PAPER="en_AU.UTF-8"
    LC_NAME="en_AU.UTF-8"
    LC_ADDRESS="en_AU.UTF-8"
    LC_TELEPHONE="en_AU.UTF-8"
    LC_MEASUREMENT="en_AU.UTF-8"
    LC_IDENTIFICATION="en_AU.UTF-8"
    

The same file in the VM contained only this one line:

    LANG="en_AU.UTF-8" 

share|improve this answer
    
thanks for your post. For the record, I had to restart my system for the fix to work. (perhaps could have used emacs eval-buffer?) –  David May 9 '11 at 14:47
add comment

I also met this problem ,as you see, your LC_ALL is empty. I did as follows and it helps:

$ sudo vim /etc/environment

and set the LC_ALL to something like en_US.UTF-8,mine is:

LANG="en_US.UTF-8"
LC_MESSAGES="C"
LC_ALL="en_US.UTF-8"

then reboot,and run locale ,and it should be something like:

LANG=zh_CN.utf8
LC_CTYPE="en_US.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=en_US.UTF-8
share|improve this answer
    
This solution works well on Ubuntu 12.04 LTS precise –  speciousfool Jan 29 '13 at 8:45
add comment

Redefining the locales and reconfiguring might be sufficient to fix the problem:

sudo locale-gen en_AU.UTF-8
sudo dpkg-reconfigure locales
share|improve this answer
add comment

If you are remotely connected to the machine over ssh (eg from a macosx device) you need to set these variables on the machine you are connecting from

add the following to ~/.bash_profile

#fix for locale issues when connecting to ubuntu servers
export LANG="en_US.utf8"
export LANGUAGE="en_US.utf8"
export LC_ALL="en_US.utf8"
share|improve this answer
1  
Is this a known fault when connecting from OS X? –  MindTooth Oct 7 '12 at 9:51
    
no idea if this is by design or a fault/bug –  Somatik Oct 8 '12 at 10:27
add comment

Seems an update fried locales somehow. The fix I found was to log out, change the language selected before logging in, and logging in again.

It might also help to reinstall the locales in synaptic, though I cannot confirm that this is what fixed it for me, I think it was logging out or something.

share|improve this answer
    
Re logging in and changing language. I see no actualy way to change language at logon.. I see text which mentions changing language, but there is no option (buttons or suchlike).. perhaps that is because I only have Australian English enabled.... and I have run all the commands above.. so it is stil a mystery at the moment... –  Peter.O Apr 1 '11 at 20:54
    
@red.bear: Try installing language-pack-en and language-support-en, then repeat the process above. –  RolandiXor Apr 1 '11 at 22:41
add comment

I tried editing locale file and choosing different languages at login.

Filtering for broken packages with Synaptic and completely removing the 9 offending packages worked for me (libreoffice and python uno).

But, I am unable to install LibreOffice without apparently corrupting the package manager. It does, however, install.

I'm on 11.04 i386. Disclaimer: There was a power failure during the last part of my installation as Ubuntu was downloading updates.

share|improve this answer
add comment

I just want to add, that I needed to edit my home profile too:

gedit ~/.profile

So in your case it would look like:

...
LANG="en_AU.UTF-8"
LANGUAGE="en_AU:en"

Log out + Log in. And all is as expected.

share|improve this answer
add comment

I had the same problem for several months, a lot of software tools warned about broken locale settings, and some even refused to run. I want to use English language, but Swedish monetary and number settings.

What finally worked for me was to edit /etc/default/locale where I removed everything in that file. I then started the Unity language setup (Settings -> Language Support), set everything up (Ubuntu wanted to install some missing components) and pressed "Apply System-wide" when I was done.

My /etc/default/locale now looks like this.

LC_NUMERIC="sv_SE.UTF-8"
LC_TIME="sv_SE.UTF-8"
LC_MONETARY="sv_SE.UTF-8"
LC_PAPER="sv_SE.UTF-8"
LC_IDENTIFICATION="sv_SE.UTF-8"
LC_NAME="sv_SE.UTF-8"
LC_ADDRESS="sv_SE.UTF-8"
LC_TELEPHONE="sv_SE.UTF-8"
LC_MEASUREMENT="sv_SE.UTF-8"
LANGUAGE="en"
LANG="en_US.UTF-8"

The big difference between this and my original file is LANGUAGE="en".

share|improve this answer
add comment

I had the same problem but going to System > Administration > Language Support may solve your problem because it may ask you to install some packages and then it will be fine!! It worked for me so i guess it'll do the same to you!!

share|improve this answer
add comment

Run

export LC_ALL="zh_CN.utf8"
ibus-setup

and select one of of the options for input method as you wish.

share|improve this answer
add comment

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.