Comment #2 on issue 3276 by [email protected]: Is there any solution
for chinese characters. (High priority)
http://code.google.com/p/v8/issues/detail?id=3276
I've tried the scenario (although not your source code)it and it works with
v8 version 3.28.4. At least the engine is not the problem.
I modified the following line:
CString temp = "'你'+'好'";
to
wchar_t* L"'你'+'好'"; // note the 'L' to define a UTF-16 string
I also had to change the encoding of the C++ source file UTF-8.
Here my code:
MyLocalIsolate isolate; // my own class to handle isolates
HandleScope handle_scope(isolate.GetCurrent());
Handle<Context> _context = Context::New (isolate.GetCurrent());
Context::Scope context_scope (_context);
Handle<String> source = String::NewFromTwoByte(isolate.GetCurrent(),
(uint16_t*)scriptCode);
Handle<String> moduleName =
String::NewFromUtf8(isolate.GetCurrent(), "IsolateTestModule");
Handle<Script> script = Script::Compile(source, moduleName);
Handle<Value> result = script->Run();
String::Value stringVal(result);
uint16_t* wstr = *stringVal;
printf("stringVal[0] = %d, expected %d %s\n", wstr[0], 20320, (wstr[0] ==
20320) ? "OK" : "FAILED");
printf("stringVal[1] = %d, expected %d %s\n", wstr[1], 22909, (wstr[1] ==
22909) ? "OK" : "FAILED");
I get the two characters 20320 and 22909 in stringVal
I'm not a v8 expert so don't take the code as good example how to use v8.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.