zshrc: Move urldecode to its own file
[grml-etc-core.git] / usr_share_grml / zsh / functions / urldecode
diff --git a/usr_share_grml/zsh/functions/urldecode b/usr_share_grml/zsh/functions/urldecode
new file mode 100644 (file)
index 0000000..8bae53a
--- /dev/null
@@ -0,0 +1,6 @@
+#f5# RFC 2396 URL encoding in Z-Shell
+emulate -L zsh
+
+setopt extendedglob
+input=( ${(s::)1} )
+print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'\(\)-])/%${(l:2::0:)$(([##16]#match))}}