qmake can not process project file with UTF-8 BOM

Project file contains UTF-8 BOM can't processesed by qmake and will
cause subtle errors.

Task-number: QTBUG-25848
Change-Id: Id69ed38c6be63a29fa3792a631cb8cb0ac176148
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Debao Zhang 2012-05-22 09:55:03 -07:00 committed by Qt by Nokia
parent a9b30841b9
commit e5bd2ed18c

View File

@ -1239,8 +1239,14 @@ QMakeProject::read(const QString &file, QHash<QString, QStringList> &place)
parser.from_file = true;
parser.file = filename;
parser.line_no = 0;
if (qfile.peek(3) == QByteArray("\xef\xbb\xbf")) {
//UTF-8 BOM will cause subtle errors
qmake_error_msg("Unexpected UTF-8 BOM found");
ret = false;
} else {
QTextStream t(&qfile);
ret = read(t, place);
}
if(!using_stdin)
qfile.close();
}