X-Git-Url: http://git.grml.org/?p=grml-scripts-core.git;a=blobdiff_plain;f=usr_sbin%2Fgrml-setlang;h=e4c82937c370c9b24caeaedc539e8924b2d2002d;hp=f8cb28bd98a39586a9088060322ecd6fcf3c7c9b;hb=a7df2300f1a684225b16bdba5e3f6087a587c939;hpb=79cf6fdc2a3ed447a47ea9652b1b6109023ebf09 diff --git a/usr_sbin/grml-setlang b/usr_sbin/grml-setlang index f8cb28b..e4c8293 100755 --- a/usr_sbin/grml-setlang +++ b/usr_sbin/grml-setlang @@ -4,7 +4,6 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Mit Sep 05 18:33:23 CEST 2007 [mika] ################################################################################ PN="$(basename $0)" @@ -166,6 +165,15 @@ if ! grep -qe "${LANGUAGE})" -qe "${LANGUAGE}|" $LANGFUNC ; then ewarn "Language ${LANGUAGE} not supported, using default." ; eend 0 fi +# fallback to C if using an ISO system (which is latin1 for LC_CTYPE); +# this should prevent users from broken ctype settings if the set +# locale isn't available on a remote system +if echo $LANGUAGE | grep -q -- '-iso' ; then + LC_CTYPE=C +else + LC_CTYPE=en_US.UTF-8 +fi + # read in the file where all the $LANGUAGE stuff is defined source $LANGFUNC @@ -173,22 +181,23 @@ fi if ! [ -r $CONFFILE ] ; then cat > $CONFFILE < LC_* > LANG +# LANGUAGE is glibc only and binds stronger than LC_ALL EOF fi -setvalue 'LANGUAGE=' $LANGUAGE -setvalue 'LANG=' $LANG -setvalue 'LC_MESSAGES=' $LANG -# setvalue 'TZ=' $TZ +setvalue 'LANG=' $LANG +setvalue 'LC_CTYPE=' $LC_CTYPE retval=$? case $retval in