Add IDN support, if 'idn' executable is available

This commit is contained in:
Thomas Ward 2019-09-17 18:57:48 -04:00
parent 3e4cd58f7b
commit 62f504ab49
No known key found for this signature in database
GPG Key ID: 5B8AD6F4C26ADDDD
1 changed files with 9 additions and 1 deletions

View File

@ -19340,7 +19340,15 @@ parse_cmd_line() {
fatal "URI missing" $ERR_CMDLINE fatal "URI missing" $ERR_CMDLINE
else else
# left off here is the URI # left off here is the URI
URI="$1" if [[ $1 = *[![:ascii:]]* ]]; then
if [[ "$(command -v idn)" == "" ]]; then
fatal "URI contains non-ASCII, IDN not available."
else
URI="$(echo $1 | idn)"
fi
else
URI="$1"
fi
# parameter after URI supplied: # parameter after URI supplied:
[[ -n "$2" ]] && fatal "URI comes last" $ERR_CMDLINE [[ -n "$2" ]] && fatal "URI comes last" $ERR_CMDLINE
fi fi