From c75cc771944738248a3d4c158539cb308253a240 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 20 May 2015 19:47:25 +0200 Subject: lib/url.sh: initial commit --- lib/url.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/url.sh (limited to 'lib') diff --git a/lib/url.sh b/lib/url.sh new file mode 100644 index 000000000..05f93a94f --- /dev/null +++ b/lib/url.sh @@ -0,0 +1,35 @@ +url_encode() { + sed ' + s/%/%25/g + s/ /%20/g + s/!/%21/g + s/"/%22/g + s/#/%23/g + s/\$/%24/g + s/\&/%26/g + s/'\''/%27/g + s/(/%28/g + s/)/%29/g + s/\*/%2a/g + s/+/%2b/g + s/,/%2c/g + s/-/%2d/g + s/\./%2e/g + s/\//%2f/g + s/:/%3a/g + s/;/%3b/g + s//%3e/g + s/?/%3f/g + s/@/%40/g + s/\[/%5b/g + s/\\/%5c/g + s/\]/%5d/g + s/\^/%5e/g + s/_/%5f/g + s/`/%60/g + s/{/%7b/g + s/|/%7c/g + s/}/%7d/g + s/~/%7e/g + ' +} -- cgit v1.2.3