starwing / luautf8

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

Fix utf8.charpattern #26

Closed shmuz closed 4 years ago

shmuz commented 4 years ago

This fixes issue #15.

shmuz commented 4 years ago

In addition to Lua 5.1 compatibility (issue #15) this patch also fixes utf8.charpattern under Lua 5.3.5.

Lua 5.3.5 has changed the definition of lua_pushliteral compared to Lua 5.1/5.2:

#define lua_pushliteral(L, s)   lua_pushstring(L, "" s)

It results in truncating the string at the 2-nd byte (which is \0).

The suggested patch fixes that by not using lua_pushliteral.

starwing commented 4 years ago

Thanks!