[CentOS] Custom locale, LC_TYPE and urxvt
James B. Byrne
byrnejb at harte-lyne.ca
Mon Jan 21 17:18:41 UTC 2013
I have a custom locale in use on our system. Consequently, Xlib does
not recognize the default environment setting for LC_TYPE. To get an
urxvt window opened without encountering the locale error message I am
therefore constrained to use some variant of the following:
I would like to set LC_TYPE to a different value than LANG. However,
based on experiment it seems that the only locale setting in
/etc/sysconfig/i18n that CentOS-6.3 responds to is LANG. I have
looked at /etc/profile.d/lang.sh but my knowledge of terminal settings
and system variables is insufficient to make much sense out of it.
if [ -n "$LANG" ]; then
[ -f "$HOME/.i18n" ] && . "$HOME/.i18n" && sourced=1
for langfile in /etc/sysconfig/i18n "$HOME/.i18n" ; do
[ -f $langfile ] && . $langfile && sourced=1
If I am not entirely mistaken, this code checks to see if $LANG is set
and saves it. Presumably this is to preserve $LANG from being
overridden by the contents of ~/.i18n but it does not even seem to
check /etc/sysconfig/i18n in that case. One might infer from this
treatment that this is because lang.sh expects that if $LANG is set
then /etc/sysconfig/i18n has already been processed.
Assuming that /etc/sysconfig/i18n is found then it processes the
if [ "$sourced" = 1 ]; then
[ -n "$LANG" ] && export LANG || unset LANG
. . .
[ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
. . .
Checking in ~/.bashrc I see this:
. . .
# Source global definitions
if [ -f /etc/bashrc ]; then
And checking /etc/bashrc I see this:
. . .
# Only display echos from profile.d scripts if we are no login shell
# and interactive - otherwise just process them to set envvars
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. "$i" >/dev/null 2>&1
However, when I look for the mate to that final 'fi' I find this:
. . .
if ! shopt -q login_shell ; then # We're not a login shell
# Need to redefine pathmunge, it get's undefined at the end of
. . .
Evidently /etc/profile.d/lang.sh only gets processed by /etc/bashrc if
I am NOT in a login shell. The question then is: when does
/etc/profile.d/lang.sh get processed? Well, numerous places it seems:
Yet, despite all these calls to /etc/profile.d/lang.sh, whenever I
open a new session in gnome-terminal LC_LANG is never set but $LANG
is. If However, I do . /etc/profile.d/lang.sh in that window session,
then LC_TYPE becomes set as I desire.
Either something is setting LANG and ignoring LC_TYPE in
/etc/sysconfig/i18n before lang.sh or something is unsetting
everything other than $LANG after lang.sh is processed.
What is going on?
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3
More information about the CentOS