Hi,
It seems that null characters in strings, that are valid in both .Net and JavaScript, are not passed between host and script in both directions.
For example:
JS length of jsString 5
Host length of jsString: 2 <---- Wrong, should be 5
Host length of hostString: 5
JS length of hostString: 2 <---- Wrong, should be 5
Thanks in advance,
Ron
It seems that null characters in strings, that are valid in both .Net and JavaScript, are not passed between host and script in both directions.
For example:
class StringTest
{
public static int GetLength(string s)
{
return s.Length;
}
}
...
engine.AddHostType("Console", typeof(Console));
// Test JS string passed to host
engine.AddHostType("StringTest", typeof(StringTest));
engine.Execute(@"
var jsString = 'ab\0cd';
Console.WriteLine('JS length of jsString {0}', jsString.length);
Console.WriteLine('Host length of jsString: {0}', StringTest.GetLength(jsString));
"
);
// Test Host string passed to JS
string hostString = "ef\0gh";
Console.WriteLine("Host length of hostString: {0}", hostString.Length);
engine.Execute("function jsLength(s) {Console.WriteLine('JS length of hostString: {0}', s.length);}");
engine.Script.jsLength(hostString);
The output I get is:JS length of jsString 5
Host length of jsString: 2 <---- Wrong, should be 5
Host length of hostString: 5
JS length of hostString: 2 <---- Wrong, should be 5
Thanks in advance,
Ron