starwing / luautf8

a utf-8 support module for Lua and LuaJIT.
MIT License
412 stars 68 forks source link

utf8_encode() not implemented properly? #6

Closed shirat74 closed 9 years ago

shirat74 commented 9 years ago

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.

starwing commented 9 years ago

Thank you for reporting and fixed in git HEAD :)

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

shirat74 commented 9 years ago

Thanks. It works fine now.