From 5ebd02ae665ab4f04f3fcebb8432dab1c1c61a48 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Wed, 26 Oct 2022 16:28:18 +0200 Subject: [PATCH] - strlen handles utf8 strings correctly --- lua.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua.cpp b/lua.cpp index b3f7443..f1adb5c 100644 --- a/lua.cpp +++ b/lua.cpp @@ -564,7 +564,7 @@ extern "C" { } static int cpp_strlen(lua_State *L) { const char* str = luaL_checkstring(L, 1); - lua_pushinteger(L, strlen(str)); + lua_pushinteger(L, utfstrlen(str)); return 1; }