From 441f3d964301942e417b238b6e71b2ad13b976f0 Mon Sep 17 00:00:00 2001 From: El Mehdi Fekari Date: Mon, 29 Jul 2013 12:03:35 +0200 Subject: [PATCH] lupdate: Fixing decoding of QML files Decode text stream from QML files as UTF-8 even when the latter is not the default system encoding (QML supports UTF-8 only). Change-Id: I32ccf88e93182ffa78345235217258761e95195a Reviewed-by: Oswald Buddenhagen --- src/linguist/lupdate/qdeclarative.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp index befeea2..41ef698 100644 --- a/src/linguist/lupdate/qdeclarative.cpp +++ b/src/linguist/lupdate/qdeclarative.cpp @@ -460,7 +460,15 @@ static bool load(Translator &translator, const QString &filename, ConversionData return false; } - QString code = QTextStream(&file).readAll(); + QString code; + if (!qmlMode) { + code = QTextStream(&file).readAll(); + } else { + QTextStream ts(&file); + ts.setCodec("UTF-8"); + ts.setAutoDetectUnicode(true); + code = ts.readAll(); + } if (! qmlMode) { // fetch the optional pragma directives for Javascript files. -- 2.7.4