Skip to content

Instantly share code, notes, and snippets.

Embed
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))}}
}
@hmeine

This comment has been minimized.

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
You can’t perform that action at this time.