Module:UrlEncoding

-- Way to encode URLs so they don't break things return { encode = function (frame) str = frame.args[1] 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, decode = function (frame) str = frame.args[1] 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") return str end }