From df8dbb37bbf199978680058891dfa9bbd5d90b74 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 4 Oct 2006 21:52:15 +0000 Subject: set iutf8 if appropriate (#186961) handle non-utf8 locales correctly (#200100) --- lang.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lang.sh') diff --git a/lang.sh b/lang.sh index 6b186ce6..e8b1a911 100755 --- a/lang.sh +++ b/lang.sh @@ -40,11 +40,13 @@ if [ "$sourced" = 1 ]; then [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS [ -n "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET + + consoletype=$(/sbin/consoletype) if [ -n "$CHARSET" ]; then case $CHARSET in 8859-1|8859-2|8859-5|8859-15|koi*) - if [ "$TERM" = "linux" -a "`/sbin/consoletype`" = "vt" ]; then + if [ "$TERM" = "linux" -a "$consoletype" = "vt" ]; then echo -n -e '\033(K' 2>/dev/null > /proc/$$/fd/0 fi ;; @@ -52,7 +54,7 @@ if [ "$sourced" = 1 ]; then elif [ -n "$SYSFONTACM" ]; then case $SYSFONTACM in iso01*|iso02*|iso05*|iso15*|koi*|latin2-ucw*) - if [ "$TERM" = "linux" -a "`/sbin/consoletype`" = "vt" ]; then + if [ "$TERM" = "linux" -a "$consoletype" = "vt" ]; then echo -n -e '\033(K' 2>/dev/null > /proc/$$/fd/0 fi ;; @@ -61,12 +63,25 @@ if [ "$sourced" = 1 ]; then if [ -n "$LANG" ]; then case $LANG in *.utf8*|*.UTF-8*) + if [ "$consoletype" = "vt" -o "$consoletype" = "pty" ]; then + stty iutf8 + fi if [ "$TERM" = "linux" ]; then - if [ "`/sbin/consoletype`" = "vt" ]; then + if [ "$consoletype" = "vt" ]; then [ -x /bin/unicode_start ] && /sbin/consoletype fg && /bin/unicode_start $SYSFONT $SYSFONTACM fi fi ;; + *) + if [ "$consoletype" = "vt" -o "$consoletype" = "pty" ]; then + stty -iutf8 + fi + if [ "$TERM" = "linux" ]; then + if [ "$consoletype" = "vt" ]; then + [ -x /bin/unicode_stop ] && /sbin/consoletype fg && /bin/unicode_stop + fi + fi + ;; esac fi -- cgit v1.2.1