mirror of https://github.com/axmolengine/axmol.git
luabindings: Add script with utf-8 bom support.
This commit is contained in:
parent
dd75d37b9d
commit
f41130bafe
|
@ -862,6 +862,14 @@ int LuaStack::luaLoadBuffer(lua_State *L, const char *chunk, int chunkSize, cons
|
|||
}
|
||||
else
|
||||
{
|
||||
// UTF-8 BOM? skip
|
||||
if (static_cast<unsigned char>(chunk[0]) == 0xEF &&
|
||||
static_cast<unsigned char>(chunk[1]) == 0xBB &&
|
||||
static_cast<unsigned char>(chunk[2]) == 0xBF)
|
||||
{
|
||||
chunk += 3;
|
||||
chunkSize -= 3;
|
||||
}
|
||||
r = luaL_loadbuffer(L, chunk, chunkSize, chunkName);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue