Skip to content

Commit 697bb32

Browse files
qaisjpccw808
authored andcommitted
Let loadstring & load load UTF-8 strings with BOM
1 parent 6294088 commit 697bb32

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Resource.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ int CLuaFunctionDefs::LoadString( lua_State* luaVM )
441441

442442
if ( !argStream.HasErrors() )
443443
{
444+
CLuaShared::CheckUTF8BOMAndUpdate ( &cpBuffer, &uiSize );
444445
if ( !CLuaMain::LuaLoadBuffer( luaVM, cpBuffer, uiSize, szChunkname ) )
445446
{
446447
// Ok
@@ -513,6 +514,7 @@ int CLuaFunctionDefs::Load( lua_State* luaVM )
513514

514515
if ( !argStream.HasErrors() )
515516
{
517+
CLuaShared::CheckUTF8BOMAndUpdate ( &cpBuffer, &uiSize );
516518
if ( !CLuaMain::LuaLoadBuffer( luaVM, cpBuffer, uiSize, szChunkname ) )
517519
{
518520
// Ok

MTA10_Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,7 @@ int CLuaResourceDefs::LoadString( lua_State* luaVM )
13071307

13081308
if ( !argStream.HasErrors() )
13091309
{
1310+
CLuaShared::CheckUTF8BOMAndUpdate ( &cpBuffer, &uiSize );
13101311
if ( !CLuaMain::LuaLoadBuffer( luaVM, cpBuffer, uiSize, szChunkname ) )
13111312
{
13121313
// Ok
@@ -1379,6 +1380,7 @@ int CLuaResourceDefs::Load( lua_State* luaVM )
13791380

13801381
if ( !argStream.HasErrors() )
13811382
{
1383+
CLuaShared::CheckUTF8BOMAndUpdate ( &cpBuffer, &uiSize );
13821384
if ( !CLuaMain::LuaLoadBuffer( luaVM, cpBuffer, uiSize, szChunkname ) )
13831385
{
13841386
// Ok

0 commit comments

Comments
 (0)