"packages/KeraLua.1.0.6/lib/xamarinmac/KeraLua.dll" did not exist on "0432ec9310e9cda077d9aaa33ca008bb924df3c6"
Commit 633361ef authored by akharlov's avatar akharlov
Browse files

fix unicode characters support in DoString

parent 25c51407
......@@ -26,6 +26,7 @@
*/
using System;
using System.IO;
using System.Text;
using NLua.Extensions;
namespace NLua
......@@ -384,7 +385,8 @@ namespace NLua
public static int LuaLLoadBuffer (LuaState luaState, string buff, string name)
{
return LuaCore.LuaNetLoadBuffer (luaState, buff, (uint)0, name);
var bytes = Encoding.UTF8.GetBytes(buff);
return LuaCore.LuaNetLoadBuffer (luaState, bytes, (uint)bytes.Length, name);
}
public static int LuaLLoadBuffer (LuaState luaState, byte [] buff, string name)
......
......@@ -157,6 +157,13 @@ namespace NLuaTest
return Convert.ToString (UnicodeChar);
}
}
public static string UnicodeStringRussian
{
get
{
return "Файл";
}
}
/*
* Tests capturing an exception
*/
......@@ -2065,6 +2072,17 @@ namespace NLuaTest
}
}
[Test]
public void TestUnicodeCharsInDoString()
{
using (Lua lua = new Lua ()) {
lua.DoString("res = 'Файл'");
string res = (string)lua["res"];
Assert.AreEqual(LuaTests.UnicodeStringRussian, res);
}
}
[Test]
public void TestCoroutine ()
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment