Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
633361ef
"packages/KeraLua.1.0.6/lib/xamarinmac/KeraLua.dll" did not exist on "0432ec9310e9cda077d9aaa33ca008bb924df3c6"
Commit
633361ef
authored
Jan 17, 2017
by
akharlov
Browse files
fix unicode characters support in DoString
parent
25c51407
Changes
2
Show whitespace changes
Inline
Side-by-side
Core/NLua/LuaLib/LuaLib.cs
View file @
633361ef
...
...
@@ -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
)
...
...
tests/LuaTests.cs
View file @
633361ef
...
...
@@ -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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment