8

I run Ubuntu 12.04, I can't set the locale to en_US.utf8. I set the LANG by configuring /etc/default/locale as described here.

$cat /etc/default/locale
LANG=en_US.utf8
$locale
LANG=
LANGUAGE=
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=POSIX

But it doesn't work, as you can see above. How do I set this LANG variable to en_US.utf8?

The reason I am asking is, when I run echo -e "\x03\bb", I get a unicode greek letter lambda symbol displayed correctly, but my issue is with emacs. In the emacs, I can't display unicode symbols, eg: C-x 8 RET 03bb outputs \u03bb, instead of a greek letter lambda symbol. I thought the issue is with these locale settings, but I can't set them.

Edit: I think the problem is fixed.

$su $USER -c 'env; echo ==; locale' | egrep '==|LANG'

LANG=en_US
LANGUAGE=en_US
==
LANG=en_US
LANGUAGE=en_US

The solution for me was, I was using mintty to ssh into Ubuntu 12.04 Server Edition, so I had to configure ~/.pam_environment and ~/.etc/ssh_config, and ~/bashrc. But my real issue with emacs was not about this ubuntu configuration, so I have no idea what this LANG variable configuration is used for or if I set it to correct values.

Edit 2: Here are the steps I've taken to solve this, following the suggestions of ansivirus from the #ubuntu irc channel:

Add this to ~/.bash_profile

export LANGUAGE="en"
export LANG="C"
export LC_MESSAGES="C"

Add this to ~/.pam_environment (so this must be problematic)

LANG=en_US
LANGUAGE=en_US

Add this to /etc/ssh/sshd_config

UsePAM yes

Comment out this in /etc/ssh/ssh_config

#   SendEnv LANG LC_*
5
  • What is the output of su $USER -c 'env; echo ==; locale' | egrep '==|LANG'? Are you using the default GUI environment (Unity), if not what are you using, and what display manager? – Gilles 'SO- stop being evil' Oct 31 '14 at 1:13
  • Is LANG present when you run su but not when you log in over SSH then? What did you change? Note that en_US is not a Unicode locale. – Gilles 'SO- stop being evil' Oct 31 '14 at 1:34
  • @Gilles, see my edit2 please. After taking those steps now LANG is kind of present I think, but I don't know what affect it has, and I don't care because emacs is fixed and I can see the unicode characters fine, I would appreciate an explanation of what these variables mean and what they affect though, thanks. – user3995789 Oct 31 '14 at 1:50
  • Also note that these didn't fix my emacs problem, it was an emacs issue after all. – user3995789 Oct 31 '14 at 1:51
  • 1
    Maybe related to: The correct spelling for the locale is AFAIK en_US.UTF-8, not .utf8 – Jan Henke Jul 14 '16 at 11:57
1

Try to reinstall locales

apt-get install --reinstall locales

Read more here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.