iso3 country code
This commit is contained in:
parent
aa4d0f6e74
commit
ef584f730b
36
dhl.sh
36
dhl.sh
|
@ -15,5 +15,39 @@ sed -i -e 's/[\u00A0\u202F[:space:]]+/ /g' -e 's/[\u2010\u2011\u2012\u2013\u002D
|
|||
# todo: convert encoding from UTF-8 to CP1252 "Windows"
|
||||
|
||||
# a possibility for conversion? seems not to be reliant
|
||||
iconv -o "$tn" -f UTF-8 -t CP1252 "$fn"
|
||||
#~ iconv -o "$tn" -f UTF-8 -t CP1252 "$fn"
|
||||
|
||||
# todo: validate length for entries
|
||||
|
||||
# todo: convert country to countrycode as in ISO3
|
||||
iso3countrycode () {
|
||||
if test "$#" -eq 0 ; then
|
||||
echo "argument missing. ($0)"
|
||||
else
|
||||
case "$1" in
|
||||
Belgien) echo "BEL";;
|
||||
Deutschland) echo "DEU";;
|
||||
England) echo "GBR";;
|
||||
Luxemburg|Luxembourg) echo "LUX";;
|
||||
Niederlande) echo "NLD";;
|
||||
Österreich) echo "AUT";;
|
||||
Schweiz) echo "CHE";;
|
||||
Ungarn) echo "HUN";;
|
||||
*) echo "unknown country: $1";exit 1;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
testiso3 () {
|
||||
iso3countrycode "Belgien"
|
||||
iso3countrycode "Deutschland"
|
||||
iso3countrycode "England"
|
||||
iso3countrycode "Luxembourg"
|
||||
iso3countrycode "Luxemburg"
|
||||
iso3countrycode "Niederlande"
|
||||
iso3countrycode "Österreich"
|
||||
iso3countrycode "Ungarn"
|
||||
iso3countrycode "Schweiz"
|
||||
iso3countrycode "Simbabwe" # should fail
|
||||
}
|
||||
testiso3
|
||||
|
|
Loading…
Reference in New Issue