Locale settings are not right. How can I reset them?

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" 


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.


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

Tags:

Locale