diff options
author | kh1 <karsten.heimrich@digia.com> | 2014-04-10 11:07:09 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@digia.com> | 2014-04-23 13:35:53 +0200 |
commit | f91f630fa2294d70f27c4c88dfa331a9f81f5387 (patch) | |
tree | 88c4bb900f0bbe58d7179e6de8936ed9819af314 /src | |
parent | b138cbfed60815b26b417a308a8fee824dab5228 (diff) |
Make sure we read the script content as UTF8.
Task-number: QTIFW-485
Change-Id: Id09365207c6f5b1312fb85ad67443f7e51a1944e
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/scriptengine.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libs/installer/scriptengine.cpp b/src/libs/installer/scriptengine.cpp index d46805ade..9908ce29d 100644 --- a/src/libs/installer/scriptengine.cpp +++ b/src/libs/installer/scriptengine.cpp @@ -252,14 +252,14 @@ QScriptValue ScriptEngine::loadInConext(const QString &context, const QString &f // Create a closure. Put the content in the first line to keep line number order in case of an // exception. Script content will be added as the last argument to the command to prevent wrong // replacements of %1, %2 or %3 inside the javascript code. - QString scriptContent = QString::fromLatin1( - "(function() {" - " %1 %3 ;" - " if (typeof %2 != \"undefined\")" - " return new %2;" + const QString scriptContent = QLatin1String("(function() {") + + scriptInjection + QString::fromUtf8(file.readAll()) + + QString::fromLatin1(";" + " if (typeof %1 != \"undefined\")" + " return new %1;" " else" " throw \"Missing Component constructor. Please check your script.\";" - "})();").arg(scriptInjection, context, QLatin1String(file.readAll())); + "})();").arg(context); QScriptValue scriptContext = evaluate(scriptContent, fileName); if (hasUncaughtException()) { |