Skip to content

Instantly share code, notes, and snippets.

@qaisjp

qaisjp/decode.lua

Forked from mabako/decode.lua
Created Jul 13, 2012
Embed
What would you like to do?
xml to real (&copy to (c) etc.)
:gsub("&#%d%d%d%d;", decode)
function decode(str)
local num = tonumber(str:sub(3,6))
local first = math.floor(num/4096)
num = num - 4096 * first
return string.char(first+224, math.floor(num/64)+128, num%64+128)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment