Skip to content

Instantly share code, notes, and snippets.

@qaisjp
Forked from mabako/decode.lua
Created July 13, 2012 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qaisjp/3107134 to your computer and use it in GitHub Desktop.
Save qaisjp/3107134 to your computer and use it in GitHub Desktop.
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