Left for archival purposes.

User avatar
By timoline
#13518 Is there somewhere a lightweight url decode/encode lua code available..

i tried the following but they are too memory intensive

Code: Select allfunction urldecode(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")
    return str
end

or
Code: Select allhex={}
for i=0,255 do
    hex[string.format("%0x",i)]=string.char(i)
    hex[string.format("%0X",i)]=string.char(i)
end

function decodeURI(s)
    return (s:gsub('%%(%x%x)',hex))
end
User avatar
By cal
#13520 Moin,

memory usage depends on the firmware you using. Latest march release uses too much.
If you can build firmware yourself reduce LUAI_BUFFERSIZE by removing the factor 4 which was introduced
by some file system changes. Unfortunately no statement from dev team about that issue yet.
There is a "gsub" thread about that issue.

Carsten