Skip to content

Instantly share code, notes, and snippets.

@zanculmarktum
Created March 19, 2018 07:28
Show Gist options
  • Save zanculmarktum/50ef114ad24ced0189bc00482ad768da to your computer and use it in GitHub Desktop.
Save zanculmarktum/50ef114ad24ced0189bc00482ad768da to your computer and use it in GitHub Desktop.
#!/bin/sh
urlencode() {
c="${1%${1#?}}"
if [ -n "$c" ]; then
case "$c" in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%.2X' "'$c" ;;
esac
urlencode "${1#?}"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment