Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm usung Ubuntu 12.04 and after an automatic update it changed the system default encoding form UTF-8 to "ANSI_X3.4-1968". I realized that when my code comments in Eclipse appeared with strange characters, and after realizing that the IDE was innocent, I've opened a terminal to check. When I type latin characters in a terminal window, such as çãõéèê..., a question mark shows instead. Same is I 'cat' a text file. Changing Ubuntu locale settings by GUI crashes the accounts-daemon:

ExecutablePath: /usr/bin/gnome-language-selector
ProcCmdline: /usr/bin/python /usr/bin/gnome-language-selector
...
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking      message, timeout)
DBusException: org.freedesktop.Accounts.Error.Failed: running '/usr/share/language-tools/save-to-pam-env' failed: no output

I've then changed the save-to-pam-env adding a debug line and executed the lang-selector in a terminal:

gag@desktop~> /usr/bin/python /usr/bin/gnome-language-selector
(gnome-language-selector:17733): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "pt_BR"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
...same message a dozen times...
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
/usr/lib/python2.7/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py:858: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  self._localeinfo.translate(loc, native=True) == defaultLangName):
  //the line below is my debug 'print'
  exec: /usr/share/language-tools/save-to-pam-env /home/likewise-open/CERTI/gag pt_BR.UTF-8 

So, running this command by hand:

gag@desktop~> /usr/share/language-tools/save-to-pam-env /home/likewise-open/CERTI/gag pt_BR.UTF-8
pt_BR.UTF-8
gag@ccd-7840~> 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=
gag@desktop~> cat .pam_environment 
LANGUAGE=en
LANG=en_US.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
LC_MONETARY=pt_BR.UTF-8
LC_PAPER=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8

It all seems fine, but restarting the PC and logging-in back things are still the same. By CLI I can see that the locales are properly installed:

gag@desktop~> locale -a | grep pt
pt_BR.utf8
pt_PT.utf8
gag@desktop~> locale -m | grep UTF
UTF-8

I've also tried:

sudo apt-get install language-pack-pt language-pack-pt-base
sudo apt-get install --reinstall locales

With no effect. When I login with another account the encoding is ok. Ideas?

share|improve this question

1 Answer 1

It turns out that my "~/.pam_environment" config is not being read at all. I've than made a workaround by setting these in my ~/.profile file:

export LC_COLLATE="C"
export LANG="en_US.UTF-8"
export LC_ALL="pt_BR.UTF-8"

Though using LC_ALL is not recommended in the "locale" man entry.

The only cause I could find googli'n arount for .pam_environment being ignored is home dir. encription usyng ecryptfs - and that's not my case.

Anyway, its working, so let it be.

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.