Basic UTF8-handling functions for Lua