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

10 Answers 10

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
up vote 18 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

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

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

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

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

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

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

sudo locale-gen en_AU.UTF-8
sudo dpkg-reconfigure locales

When you run sudo dpkg-reconfigure locales you can select the locale you want by clicking on spacebar and moving with and before hitting Enter.

share|improve this answer

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

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

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.
{"cc_re__cc_re__cc_by_sa_3_0": ["sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com?utm_source=stackoverflow.com&amp;utm_medium=site-ui&amp;utm_campaign=footerlink\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2014 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a>                   with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2014.11.28.2054\r\n            </div>\r\n                <div id=\"additional-notices\">\r\n                    Ubuntu and Canonical are registered trademarks of Canonical Ltd.\r\n                </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-w"], "copyright__copyright__copyright": ["Y=\"sv_SE.UTF-8\"\nLC_PAPER=\"sv_SE.UTF-8\"\nLC_IDENTIFICATION=\"sv_SE.UTF-8\"\nLC_NAME=\"sv_SE.UTF-8\"\nLC_ADDRESS=\"sv_SE.UTF-8\"\nLC_TELEPHONE=\"sv_SE.UTF-8\"\nLC_MEASUREMENT=\"sv_SE.UTF-8\"\nLANGUAGE=\"en\"\nLANG=\"en_US.UTF-8\"\n\nThe big difference between this and my original file is LANGUAGE=\"en\".\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}