2 u012023801 u012023801 于 2014.11.21 21:53 提问

google V8 执行脚本返回中文字符串乱码

Isolate* isolate = Isolate::New();
{
Isolate::Scope isolate_scope(isolate);

    HandleScope handle_scope(isolate);

    Local<Context> context = Context::New(isolate);

    Context::Scope context_scope(context);

    Local<String> source = String::NewFromUtf8(isolate, "'好'");

    Local<Script> script = Script::Compile(source);

    Local<Value> result = script->Run();

    String::Utf8Value utf8(result);

    printf("%s\n", *utf8);
}
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!