2023-07-01 11:58:00 -04:00
|
|
|
function decodeChar(hex)
|
2026-04-30 12:34:36 -04:00
|
|
|
return string.char(tonumber(hex,16))
|
2023-07-01 11:58:00 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function decodeString(str)
|
2026-04-30 12:34:36 -04:00
|
|
|
local output, t = string.gsub(str,"%%(%x%x)",decodeChar)
|
|
|
|
|
return output
|
2023-07-01 11:58:00 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- will print "http://foo bar/"
|
|
|
|
|
print(decodeString("http%3A%2F%2Ffoo%20bar%2F"))
|