check for utf-8 locale

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-12-24 09:19:54 +01:00
parent 824cf137d9
commit 450d94d4d3

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ v1.2-dev2-58-g4d1c237 #### $$VERSION$$ v1.2-dev2-59-g824cf13
# #
# Exit Codes: # Exit Codes:
# - 0 success (hopefully) # - 0 success (hopefully)
@ -43,9 +43,14 @@ if [ -t 1 ] && [ -n "$TERM" ]; then
NC='\e[0m' NC='\e[0m'
fi fi
# telegram uses utf-8 characters, check if we have an utf-8 charset
if [ "${LANG}" = "${LANG%[Uu][Tt][Ff]*}" ]; then
echo -e "${ORANGE}Warning: Telegram uses utf-8, but looks like you are using non utf-8 locale:${NC} ${LANG}"
fi
# we need some bash 4+ features, check for old bash by feature # we need some bash 4+ features, check for old bash by feature
if [ "$({ LC_ALL=C.utf-8 echo -e "\u1111"; } 2>/dev/null)" == "\u1111" ]; then if [ "$({ LC_ALL=C.utf-8 echo -e "\u1111"; } 2>/dev/null)" = "\u1111" ]; then
echo -e "${ORANGE}Warning: Missing unicode '\uxxxx' support, no unicode locale set or to old bash version.${NC}" echo -e "${ORANGE}Warning: Missing unicode '\uxxxx' support, missing C.utf-8 locale or to old bash version.${NC}"
fi fi