lua € thing, unicode(like utf16)->utf8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: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 |
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
Um, what is this for?