Skip to content

Instantly share code, notes, and snippets.

@lucasad
Created September 7, 2013 09:40
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasad/6474224 to your computer and use it in GitHub Desktop.
Save lucasad/6474224 to your computer and use it in GitHub Desktop.
ZSH urlencode
urlencode() {
setopt localoptions extendedglob
input=( ${(s::)1} )
print ${(j::)input/(#b)([^A-Za-z0-9_.\!~*\'\(\)-])/%${(l:2::0:)$(([##16]#match))}}
}
@hmeine
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