Software /
code /
prosody
Diff
util/datamanager.lua @ 7732:aba3dd84d9f0
util.datamanager: Use the 'base' argument to tonumber() to indicate hexadecimal
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 20 Nov 2016 12:03:24 +0100 |
parent | 7674:8027eecc750f |
child | 7733:601c4d81603b |
line wrap: on
line diff
--- a/util/datamanager.lua Sun Nov 20 11:51:13 2016 +0100 +++ b/util/datamanager.lua Sun Nov 20 12:03:24 2016 +0100 @@ -50,7 +50,7 @@ ---- utils ----- local encode, decode; do - local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = char(tonumber("0x"..k)); return t[k]; end }); + local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = char(tonumber(k, 16)); return t[k]; end }); decode = function (s) return s and (s:gsub("+", " "):gsub("%%([a-fA-F0-9][a-fA-F0-9])", urlcodes));