Created
March 19, 2018 07:28
-
-
Save zanculmarktum/50ef114ad24ced0189bc00482ad768da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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