starwing/luautf8

utf8_encode() not implemented properly?

shirat74 opened this issue · 2 comments

The following example

local utf8 = require("lua-utf8")
local ustr = utf8.char(0x20000)
print(string.format("U+%05x", utf8.codepoint(ustr)))

gives the result

U+003c0

I think there is something wrong in utf8_encode() in treating Unicode >= U+10000.
I am using luautf8 0.1.0-1 installed via LuaRocks on Lua5.2.

Thank you for reporting and fixed in git HEAD :)

you can try luarocks install luautf8 to update to 0.1.1-1 version.

Thanks. It works fine now.