summaryrefslogtreecommitdiffstats
path: root/lib/url.sh
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-05-20 19:47:25 +0200
committertv <tv@krebsco.de>2015-05-20 19:47:25 +0200
commit8b9b6f2a051a7b6695491a6f17d58203f823bdc9 (patch)
treef4e7d389e1889ff5833b9d374543ef1e33d4547b /lib/url.sh
parent55a3c5e2116ce3905d014075b01c827eae6e41ee (diff)
lib/url.sh: initial commit
Diffstat (limited to 'lib/url.sh')
-rw-r--r--lib/url.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/url.sh b/lib/url.sh
new file mode 100644
index 0000000..05f93a9
--- /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
+ '
+}