From a14bc5f668f8e7591de87bc42ae311acc6da52ad Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 18 Dec 2012 21:16:04 +0100 Subject: [PATCH] Enhance guessing if UTF-8 or ISO8859-1 encoding should be used --- sys/profile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/profile b/sys/profile index 8afa7ca..a2def55 100644 --- a/sys/profile +++ b/sys/profile @@ -14,8 +14,16 @@ export PROFILEREAD export UID # Indicates LC_CTYPE an UTF-8 terminal? -[ -n "$LC_CTYPE" ] \ - && LC_encoding="${LC_CTYPE#*.}" || LC_encoding="ISO8859-1" +if [ -n "$LC_CTYPE" ]; then + LC_encoding="${LC_CTYPE#*.}" +else + case "$TERM" in + "xterm-"*) + LC_encoding="UTF-8"; ;; + *) + LC_encoding="ISO8859-1" + esac +fi # Set locale if it is not set or doesn't contain a dot: [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \ && export LANG="${LANG:-de_DE}.${LC_encoding}" -- 2.39.2