Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ZSH urlencode
urlencode() {
setopt localoptions extendedglob
input=( ${(s::)1} )
print ${(j::)input/(#b)([^A-Za-z0-9_.\!~*\'\(\)-])/%${(l:2::0:)$(([##16]#match))}}
Copy link

hmeine commented Nov 15, 2013

Unreadable, but functional. Thanks. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment