Ubuntu 10.04 locale LANG and LC_ALL are unset

Hello;

I have a Ubuntu 10.04.1 LTS VPS here.

And I have a little problem with environment variables.

In my environment when I try to run $ locale it gives result as

LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

because of that I cannot use utf-8 characters in terminal.

I have tried # dpkg-reconfigure locales and it gives result as

Generating locales...
  en_AG.UTF-8... up-to-date
  en_AU.UTF-8... up-to-date
  en_BW.UTF-8... up-to-date
  en_CA.UTF-8... up-to-date
  en_DK.UTF-8... up-to-date
  en_GB.UTF-8... up-to-date
  en_HK.UTF-8... up-to-date
  en_IE.UTF-8... up-to-date
  en_IN.UTF-8... up-to-date
  en_NG.UTF-8... up-to-date
  en_NZ.UTF-8... up-to-date
  en_PH.UTF-8... up-to-date
  en_SG.UTF-8... up-to-date
  en_US.UTF-8... up-to-date
  en_ZA.UTF-8... up-to-date
  en_ZW.UTF-8... up-to-date
Generation complete.

but still $ locale gives same..

I have researched by Google and I have find out that i dont have "/etc/default/locale" file.. I have generated that but nothing changes…

I have searched in this forum and I have found this topic.. but $ apt-get install locales-all didn't work out..

I am a newbie on linux.

Is the problem for just me?

Does anybody have a solution for this problem?

or

Can anybody show me the right direction to solve this problem?

Thanks for your time…

7 Replies

Try

apt-get install --reinstall locales

Also try adding the following line to /etc/default/locale

LANG="en_US.UTF-8"

Also, you can set system-wide environment variables by specifying them in /etc/environment

See: https://help.ubuntu.com/community/EnvironmentVariables

@hybinet:

Try

apt-get install --reinstall locales

Also try adding the following line to /etc/default/locale

LANG="en_US.UTF-8"

Also, you can set system-wide environment variables by specifying them in /etc/environment

See: https://help.ubuntu.com/community/EnvironmentVariables

thanks for reply

reinstallation

$ sudo apt-get install --reinstall locales
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 3552kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ lucid/main locales 2.11+git20100304-3 [3552kB]
Fetched 3552kB in 0s (11.8MB/s)
(Reading database ... 42040 files and directories currently installed.)
Preparing to replace locales 2.11+git20100304-3 (using .../locales_2.11+git20100304-3_all.deb) ...
Unpacking replacement locales ...
Processing triggers for man-db ...
Setting up locales (2.11+git20100304-3) ...
Generating locales...
  en_AG.UTF-8... up-to-date
  en_AU.UTF-8... up-to-date
  en_BW.UTF-8... up-to-date
  en_CA.UTF-8... up-to-date
  en_DK.UTF-8... up-to-date
  en_GB.UTF-8... up-to-date
  en_HK.UTF-8... up-to-date
  en_IE.UTF-8... up-to-date
  en_IN.UTF-8... up-to-date
  en_NG.UTF-8... up-to-date
  en_NZ.UTF-8... up-to-date
  en_PH.UTF-8... up-to-date
  en_SG.UTF-8... up-to-date
  en_US.UTF-8... up-to-date
  en_ZA.UTF-8... up-to-date
  en_ZW.UTF-8... up-to-date
Generation complete.

after reinstallation result the same

$ locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

there is no any /etc/default/locale file.. I have tried to create it and result is the same…

/etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

how should I change the environment file ?

LANG="en_US.UTF-8"

Create the /etc/default/locale file, and add the line above.

In the case of /etc/environment, keep the existing line, and add another line below it.

Log out, and log back in. If you don't see any changes, try rebooting your Linode.

I did exactly what you have said.. And threre is no changes…

That's strange, the locale setting should stick after a reboot. Did the file(s) get deleted/overwritten by something?

@hybinet:

That's strange, the locale setting should stick after a reboot. Did the file(s) get deleted/overwritten by something?

I didn't see that kind of message.. I believe it is the same since the beginning..

When I installed postgresql server it installed as ASCII encoding.. I had to reconfigure it to convert it to UTF8.. And normally it installs as UTF8 encoding..

Edit:

when I try as root

$ sudo su
$ locale
LANG=en_US.UTF-8
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=

but this is not work

$ sudo -i
$ locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

Solution:

I found the solution:

Adding this line into ~/.bashrc file gives correct output

export LANG=en_US.UTF-8

here is the reference

Thank you all for your replies..

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct