mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2519 from dumganhar/iss2106-js-bytecode
fixed #2106: Fixing wrong display of non-ascii characters. The compiler needs to setUTF8 for compile option.
This commit is contained in:
commit
47cff27ecd
|
@ -80,8 +80,11 @@ bool CompileFile(const std::string &inputFilePath, const std::string &outputFile
|
||||||
JSObject* global = JS_NewGlobalObject(context, &GlobalClass, NULL);
|
JSObject* global = JS_NewGlobalObject(context, &GlobalClass, NULL);
|
||||||
JS_SetErrorReporter(context, &ReportError);
|
JS_SetErrorReporter(context, &ReportError);
|
||||||
if (JS_InitStandardClasses(context, global)) {
|
if (JS_InitStandardClasses(context, global)) {
|
||||||
|
|
||||||
JS::CompileOptions options(context);
|
JS::CompileOptions options(context);
|
||||||
|
options.setUTF8(true);
|
||||||
options.setSourcePolicy(JS::CompileOptions::NO_SOURCE);
|
options.setSourcePolicy(JS::CompileOptions::NO_SOURCE);
|
||||||
|
|
||||||
js::RootedObject rootedObject(context, global);
|
js::RootedObject rootedObject(context, global);
|
||||||
std::cout << "Compiling ..." << std::endl;
|
std::cout << "Compiling ..." << std::endl;
|
||||||
JSScript *script = JS::Compile(context, rootedObject, options, inputFilePath.c_str());
|
JSScript *script = JS::Compile(context, rootedObject, options, inputFilePath.c_str());
|
||||||
|
|
Loading…
Reference in New Issue