View source for Module:UrlEncoding
Appearance
You do not have permission to edit this page, for the following reason:
You can view and copy the source of this page.
-- Way to encode URLs so they don't break things
local encode = function (str)
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, " ", "+")
return str
end
local decode = function (str)
str = string.gsub (str, "+", " ")
str = string.gsub (str, "%%(%x%x)",
function(h) return string.char(tonumber(h,16)) end)
str = string.gsub (str, "\r\n", "\n")
end
return {
_encode = encode,
_decode = decode,
encode = function (frame)
str = frame.args[1]
000
1:0
Templates used on this page:
- Template:Documentation (view source)
- Template:Documentation/en (view source)
- Module:Arguments (view source)
- Module:Documentation (view source)
- Module:Documentation/config (view source)
- Module:Documentation/i18n (view source)
- Module:Documentation/styles.css (view source)
- Module:Message box (view source)
- Module:TNT (view source)
- Module:UrlEncoding (view source)
- Module:UrlEncoding/doc (view source)
- Module:Yesno (view source)
Return to Module:UrlEncoding.