Skip to content

Instantly share code, notes, and snippets.

@marcozink
Created August 21, 2017 15:00
Show Gist options
  • Save marcozink/e3924c85e6be97dea80d03b57f9f46fb to your computer and use it in GitHub Desktop.
Save marcozink/e3924c85e6be97dea80d03b57f9f46fb to your computer and use it in GitHub Desktop.
function urlencode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment