backport UTF-8 library from Lua 5.3.0-work2