Difference between revisions of "Module:Urldecode"
Jump to navigation
Jump to search
(Created page with "local p = {} function p.urlDecode( frame ) local enctype = frame.args[2] local ret = nil; if (frame.args[2] ~= nil) then enctype = mw.ustring.upper(enctype) if ((encty...") |
(No difference)
|
Latest revision as of 23:04, 20 January 2022
Functions
- Function urlDecode reverses the transformation by magic word
{{urlencode:}}.
{{#invoke:Urldecode|urlDecode|C%C3%B4te+d%27Ivoire}}would produceCôte d'Ivoire
See also
- {{urldecode}}
- {{format linkr}}
local p = {}
function p.urlDecode( frame )
local enctype = frame.args[2]
local ret = nil;
if (frame.args[2] ~= nil) then
enctype = mw.ustring.upper(enctype)
if ((enctype == "QUERY") or (enctype == "PATH") or (enctype == "WIKI")) then
ret = mw.uri.decode(frame.args[1],frame.args[2])
end
else
ret = mw.uri.decode(frame.args[1])
end
ret = string.gsub(ret, "{", "{")
ret = string.gsub(ret, "}", "}")
return ret
end
return p