LC_CTYPE, LC_MESSAGES, LC_* are incorrectly escaped by startup scripts

Bug #116438 reported by Mikko Rantalainen on 2007-05-23
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu
Undecided
Unassigned

Bug Description

This problem is also the cause for error messages such as

(gedit:21736): Gdk-WARNING **: locale not supported by Xlib
(gedit:21736): Gdk-WARNING **: cannot set locale modifiers

The problem is that I have following defined in /etc/environment (to simulate missing en_FI):

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
LANG="en_US.UTF-8"
LANGUAGE="en_FI:en"
# see also http://myy.helia.fi/~karte/english_in_finland_on_ubuntu.html
LC_MESSAGES="en_DK.UTF-8"
LANG="en_DK.UTF-8" # fallback if LC_specific not set
LC_PAPER="fi_FI.UTF-8" # a4, can't print without this
LC_MEASUREMENT="fi_FI.UTF-8" # metric system
LC_NUMERIC="fi_FI.UTF-8" # 100 000,02 fi keyboard numpad has comma not dot
LC_MONETARY="fi_FI.UTF-8" # EUR
LC_TIME="en_DK.UTF-8" # iso-8601, 24h + weeks start Mon + format yyyy-mm-dd HH:MM
LC_CTYPE="fi_FI.UTF-8" # which characters are letter
LC_COLLATE="fi_FI.UTF-8" # sort order, eg. a" ä is after z
LC_NAME="fi_FI.UTF-8"
LC_ADDRESS="fi_FI.UTF-8"
LC_TELEPHONE="fi_FI.UTF-8"

so far so good. However, once I log in via console (CTRL+ALT+F1) or gdm/X.org and launch any programs (Gnome terminal or xterm, for example) the environment is messed up when it comes to locale settings.

$ set | grep LC_
LC_ADDRESS=fi_FI.UTF-8
LC_COLLATE='fi_FI.UTF-8" '
LC_CTYPE='fi_FI.UTF-8" '
LC_MEASUREMENT='fi_FI.UTF-8" '
LC_MESSAGES='en_DK.UTF-8" '
LC_MONETARY='fi_FI.UTF-8" '
LC_NAME=fi_FI.UTF-8
LC_NUMERIC='fi_FI.UTF-8" '
LC_PAPER='fi_FI.UTF-8" '
LC_TELEPHONE=fi_FI.UTF-8
LC_TIME='en_DK.UTF-8" '

Notice how LC_ADDRESS, LC_TELEPHONE and LC_NAME are fine but all the other LC_* environment variables have some weird double encoding going on. If I run
$ source /etc/environment
then all is fine again. My shell is /bin/bash in /etc/passwd.

I have no idea which part of the startup/login scripts does the mangling.

$ cat /etc/issue.net
Ubuntu 6.06.1 LTS
$ uname -a
Linux semyo329k.ktl.jyu.fi 2.6.15-28-k7 #1 SMP PREEMPT Tue Mar 13 21:02:30 UTC 2007 i686 GNU/Linux
$ locale -a
C
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
fi_FI.utf8
POSIX
$ locale
LANG=en_DK.UTF-8"
LANGUAGE=en_FI:en
LC_CTYPE=fi_FI.UTF-8"
LC_NUMERIC=fi_FI.UTF-8"
LC_TIME=en_DK.UTF-8"
LC_COLLATE=fi_FI.UTF-8"
LC_MONETARY=fi_FI.UTF-8"
LC_MESSAGES=en_DK.UTF-8"
LC_PAPER=fi_FI.UTF-8"
LC_NAME=fi_FI.UTF-8
LC_ADDRESS=fi_FI.UTF-8
LC_TELEPHONE=fi_FI.UTF-8
LC_MEASUREMENT=fi_FI.UTF-8"
LC_IDENTIFICATION="en_DK.UTF-8" "
LC_ALL=

If somebody can tell me which script/program touches the LC_* variables I may be able to help to fix the problem.

Mikko Rantalainen (mira) wrote :

The incorrect escaping seems to only happen if /etc/environment includes quote character ("). If one uses syntax like
LC_CTYPE=fi_FI.UTF8
in the file /etc/environment then the problem is not visible.

Consider the above as a workaround. The real problem is incorrect parsing of file /etc/environment by yet unknown scripts.

Confirmed by duplicate bug #141407.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers