From 340c66086e8829c1680f8e3f53063781c7fd7788 Mon Sep 17 00:00:00 2001 From: vv01f Date: Thu, 23 Jul 2020 11:29:28 +0200 Subject: [PATCH] fix utf-8 format check --- dhl.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dhl.sh b/dhl.sh index ab5d724..d808c8e 100755 --- a/dhl.sh +++ b/dhl.sh @@ -164,7 +164,6 @@ testiso3 () { testcmp "IND" "iso3countrycode" "Indien" "India" "Inde" "Bharat" testcmp "CHN" "iso3countrycode" "China" "China" "Chine" "中国" "Zhōngguó" testcmp "JPN" "iso3countrycode" "Japan" "Japan" "Japon" "Nippon" "Nihon" - testcmp "" "iso3countrycode" "Simbabwe" # should fail } @@ -236,8 +235,8 @@ convcsv () { if test $# -eq 0 ; then >&2 echo "argument missing."; exit 1; fi # doc for headless conversion options https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options if="${1}" - format=$(file ${if}|cut -d':' -f2-|cut -d' ' -f2) - if test "$format" != "UTF-8" ; then >&2 echo "source file encoding not matching the expected UTF-8."; fi + format=$(file ${if}|rev|cut -d':' -f1|rev|cut -d' ' -f2) + if test "$format" != "UTF-8" ; then >&2 echo "source file encoding not matching 'UTF-8' as expected."; fi of=$(echo "${if}"|rev|cut -d. -f2-|rev)".ods" if test -e $of ; then >&2 echo "output file already exists."; exit 2; fi #~ iconv -o "$of" -f $format -t cp1252//TRANSLIT "$if"