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:
James Chen 2013-05-06 22:09:27 -07:00
commit 47cff27ecd
1 changed files with 3 additions and 0 deletions

View File

@ -80,8 +80,11 @@ bool CompileFile(const std::string &inputFilePath, const std::string &outputFile
JSObject* global = JS_NewGlobalObject(context, &GlobalClass, NULL);
JS_SetErrorReporter(context, &ReportError);
if (JS_InitStandardClasses(context, global)) {
JS::CompileOptions options(context);
options.setUTF8(true);
options.setSourcePolicy(JS::CompileOptions::NO_SOURCE);
js::RootedObject rootedObject(context, global);
std::cout << "Compiling ..." << std::endl;
JSScript *script = JS::Compile(context, rootedObject, options, inputFilePath.c_str());