Created
January 10, 2014 10:47
-
-
Save coderofsalvation/8349984 to your computer and use it in GitHub Desktop.
decodes an urlencoded string (%20 to ' ' e.g.)
This file contains hidden or 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
| # decodes an urlencoded string (%20 to ' ' e.g.) | |
| # @param string input | |
| # usage: echo "http://foo.com/foo.php$(urldecode "?foo=bar bar")" | |
| urldecode(){ | |
| data="$(cat - | sed 's/+/ /g')" | |
| printf '%b' "${data//%/\x}" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment