View source for Module:N34
Appearance
You do not have permission to edit this page, for the following reason:
You can view and copy the source of this page.
local n34 = {}
local gsub, char, byte, format = string.gsub, string.char, string.byte, string.format
local entityMap = {["lt"]="<",["gt"]=">",["amp"]="&",["quot"]='"',["apos"]="'"}
local entitySwap = function(orig,n,s)
return (n=='' and entityMap[s])
or (n=="#" and tonumber(s)) and char(s)
or (n=="#x" and tonumber(s,16)) and char(tonumber(s,16))
or orig
end
function n34.encode ( frame )
local args = frame.args;
local str = args[1];
str = gsub (str, "\n", "\r\n")
str = gsub (str, "([^%w ])",
function (c) return format ("%%%02X", byte(c)) end)
str = gsub (str, " ", "+")
return str
end
function n34.decode( frame )
000
1:0
Template used on this page:
Return to Module:N34.