summaryrefslogtreecommitdiffstats
path: root/qmake/library/qmakevfs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/library/qmakevfs.cpp')
-rw-r--r--qmake/library/qmakevfs.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/qmake/library/qmakevfs.cpp b/qmake/library/qmakevfs.cpp
index 16e21395ba..2239a2beec 100644
--- a/qmake/library/qmakevfs.cpp
+++ b/qmake/library/qmakevfs.cpp
@@ -35,6 +35,10 @@ using namespace QMakeInternal;
#include <qfile.h>
#include <qfileinfo.h>
+#ifndef QT_NO_TEXTCODEC
+#include <qtextcodec.h>
+#endif
+
#define fL1S(s) QString::fromLatin1(s)
QT_BEGIN_NAMESPACE
@@ -45,6 +49,9 @@ QMakeVfs::QMakeVfs()
, m_magicExisting(fL1S("existing"))
#endif
{
+#ifndef QT_NO_TEXTCODEC
+ m_textCodec = 0;
+#endif
}
#ifdef PROPARSER_THREAD_SAFE
@@ -211,7 +218,11 @@ QMakeVfs::ReadResult QMakeVfs::readFile(int id, QString *contents, QString *errS
*errStr = fL1S("Unexpected UTF-8 BOM");
return ReadOtherError;
}
- *contents = QString::fromLocal8Bit(bcont);
+ *contents =
+#ifndef QT_NO_TEXTCODEC
+ m_textCodec ? m_textCodec->toUnicode(bcont) :
+#endif
+ QString::fromLocal8Bit(bcont);
return ReadOk;
}
@@ -262,4 +273,11 @@ void QMakeVfs::invalidateContents()
}
#endif
+#ifndef QT_NO_TEXTCODEC
+void QMakeVfs::setTextCodec(const QTextCodec *textCodec)
+{
+ m_textCodec = textCodec;
+}
+#endif
+
QT_END_NAMESPACE