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
d0a17a61
Commit
d0a17a61
authored
Feb 07, 2017
by
Vinicius Jarina
Committed by
GitHub
Feb 07, 2017
Browse files
Merge pull request #223 from halex2005/master
fix unicode characters support in DoString If is green is mergeable
👍
😉
parents
25c51407
633361ef
Changes
2
Show whitespace changes
Inline
Side-by-side
Core/NLua/LuaLib/LuaLib.cs
View file @
d0a17a61
...
...
@@ -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 @
d0a17a61
...
...
@@ -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