From fcd289293e3e343d2a13d7e9f750b7ca37586605 Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Fri, 16 Sep 2016 20:48:18 +0200 Subject: [PATCH] cc-test.sh: detect utf-8, not only utf8 locales --- cc-test.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/cc-test.sh b/cc-test.sh index 47d8965c..2a2d1f72 100755 --- a/cc-test.sh +++ b/cc-test.sh @@ -7,6 +7,7 @@ CONF=./make.rc BODY=./.cc-body.txt MBOX=./.cc-test.mbox MAIL=/dev/null +#UTF8_LOCALE= autodetected unless set if ( command -v command ) >/dev/null 2>&1; then :; else command() { @@ -23,13 +24,6 @@ rm=${rm:-`command -v rm`} sed=${sed:-`command -v sed`} grep=${grep:-`command -v grep`} -if [ -z "${UTF8_LOCALE}" ]; then - UTF8_LOCALE= - if command -v locale >/dev/null 2>&1; then - UTF8_LOCALE=`(locale -a | ${grep} -i utf8 | uniq) 2>/dev/null` - fi -fi - ## -- >8 -- 8< -- ## export SNAIL ARGS CONF BODY MBOX MAIL MAKE awk cat cksum rm sed grep @@ -49,6 +43,24 @@ if { echo ${SHELL} | ${grep} nologin; } >/dev/null 2>&1; then export SHELL fi +if [ -z "${UTF8_LOCALE}" ]; then + UTF8_LOCALE= + if command -v locale >/dev/null 2>&1; then + UTF8_LOCALE=`locale -a | { m= + while read n; do + if { echo ${n} | ${grep} -i 'utf-\{0,1\}8'; } >/dev/null 2>&1; then + m=${n} + if { echo ${n} | ${grep} -e POSIX -e en_EN -e en_US; }; then + exit 0 + fi + fi + m=${n} + done + echo ${m} + }` + fi +fi + ESTAT=0 usage() { -- 2.11.4.GIT