[ -n "$UID" ] || UID=`id -u`
export UID
-# Set locale if it is not set or doesn't contain a dot;
-# but all system messages should still be in "native" ("C") language.
+# Indicates LC_CTYPE an UTF-8 terminal?
+[ -n "$LC_CTYPE" ] \
+ && LC_encoding="${LC_CTYPE#*.}" || LC_encoding="ISO8859-1"
+# Set locale if it is not set or doesn't contain a dot:
[ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
- && export LANG="${LANG:-de_DE}.ISO8859-1"
+ && export LANG="${LANG:-de_DE}.${LC_encoding}"
+# All system messages should still be in "native" ("C") language:
export LC_MESSAGES="C"
+# Clean up ...
+unset LC_CTYPE LC_encoding
# Initialize PATH variable
if [ -x /usr/libexec/path_helper ]; then