From b49d2f11ccf6582382cc75edc0a5bd86377d48d1 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Tue, 20 Jun 2023 20:37:15 +0800 Subject: [PATCH] Update ssh.sh --- scripts/ssh.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/ssh.sh b/scripts/ssh.sh index 9bddf1c..9d77411 100644 --- a/scripts/ssh.sh +++ b/scripts/ssh.sh @@ -28,6 +28,15 @@ for ((int = 0; int < ${#REGEX[@]}; int++)); do done [[ -z $SYSTEM ]] && exit 1 [[ $EUID -ne 0 ]] && exit 1 +utf8_locale=$(locale -a 2>/dev/null | grep -i -m 1 -E "UTF-8|utf8") +if [[ -z "$utf8_locale" ]]; then + echo "No UTF-8 locale found" +else + export LC_ALL="$utf8_locale" + export LANG="$utf8_locale" + export LANGUAGE="$utf8_locale" + echo "Locale set to $utf8_locale" +fi checkupdate(){ if command -v apt-get > /dev/null 2>&1; then