Module:Fullurlencode
Jump to navigation
Jump to search
--- Replaces all characters, etc. with %XX format to help reduce spam,
-- particularly with mailto: links.
--
-- @release alpha
-- @usage {{#invoke:fullurlencode||texttoencode}}
local function url(text)
local splittext = mw.text.split(text, '')
for k,v in pairs(splittext) do
splittext[k] = '%' .. string.format("%x", string.byte(v))
end
return table.concat(splittext)
end
return {
[''] = function(frame)
local args = require("Module:Arguments").getArgs(frame)
local text = args[1]
return url(text)
end
}