From a0c267b10ad01064e9282ea38577cbd71d0944af Mon Sep 17 00:00:00 2001 From: Hugo Lima Date: Mon, 8 Feb 2010 07:55:37 -0200 Subject: Code injection from external files are always read using UTF-8. Reviewed by Marcelo Lira --- typesystem.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'typesystem.cpp') diff --git a/typesystem.cpp b/typesystem.cpp index ca40332b6..220d5af1e 100644 --- a/typesystem.cpp +++ b/typesystem.cpp @@ -1541,10 +1541,9 @@ bool Handler::startElement(const QString &, const QString &n, m_generate != TypeEntry::GenerateNothing && !file_name.isEmpty()) { if (QFile::exists(file_name)) { - QFile code_file(file_name); - if (code_file.open(QIODevice::ReadOnly)) { - QString content; - content = code_file.readAll(); + QFile codeFile(file_name); + if (codeFile.open(QIODevice::Text | QIODevice::ReadOnly)) { + QString content = QString::fromUtf8(codeFile.readAll()); content.prepend("// ========================================================================\n" "// START of custom code block [file: " + file_name + "]\n"); content.append("\n// END of custom code block [file: " + file_name + "]\n" -- cgit v1.2.3