From 800952a17a453cfe1630a12c4836d2751204fd42 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 7 May 2013 13:07:40 +0800 Subject: [PATCH] fixed #2106: Fixing wrong display of non-ascii characters. The compiler needs to setUTF8 for compile option. --- tools/jsbcc/src/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/jsbcc/src/main.cpp b/tools/jsbcc/src/main.cpp index c34f4f45c3..f052f8b2d4 100644 --- a/tools/jsbcc/src/main.cpp +++ b/tools/jsbcc/src/main.cpp @@ -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());