lua url编码 decodeURI encodeURI

  |   0 评论   |   0 浏览
function decodeURI(s)
    s = string.gsub(s, '%%(%x%x)', function(h) return string.char(tonumber(h, 16)) end)
    return s
end

function encodeURI(s)
    s = string.gsub(s, "([^%w%.%- ])", function(c) return string.format("%%%02X", string.byte(c)) end)
    return string.gsub(s, " ", "+")
end


标题:lua url编码 decodeURI encodeURI
作者:码霸霸
地址:https://blog.lupf.cn/articles/2021/06/04/1622820021691.html