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'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 when 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 okay. Ideas?

share|improve this question

1 Answer 1

I had the same problem after upgrading my system (xubuntu 12.04, using likewise open): I had no problems if I logged in with my system account, but if I logged in with an AD account I couldn't make the locale settings work (my default setting is it_IT, but somehow it was changed to en_US).

I tried the same commands you report with no success, but finally changing my display manager make it.

I supposed it was a problem with lightdm, so I tried switching to an other DM (slim):

sudo dpkg-reconfigure slim

and after a reboot I found that the system was set with the right language.

I decided to switch back to lightdm because I had problems with my screen's resolution and after running

sudo dpkg-reconfigure lightdm

and a reboot everything was fine.

Maybe it could be right just to run the reconfiguration of lightdm.

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.