Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lua € thing, unicode(like utf16)->utf8
: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
@qaisjp

This comment has been minimized.

Copy link

@qaisjp qaisjp commented Jul 11, 2012

Um, what is this for?

@mabako

This comment has been minimized.

Copy link
Owner Author

@mabako mabako commented Jul 13, 2012

Converting "this is 9.99&# 8364; of stuff" (unnecessary space between # and 8, cause Github wouldn't show it correctly) to "this is 9.99€ worth of stuff", i.e. a simple unicode conversion for what concerns decimal representations. Not entirely tested out, that said, no hex support either. Was made on a request :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment