diff options
Diffstat (limited to 'src/shared/proparser/qmakevfs.cpp')
-rw-r--r-- | src/shared/proparser/qmakevfs.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/shared/proparser/qmakevfs.cpp b/src/shared/proparser/qmakevfs.cpp index 6115a024572..4dd1192aff7 100644 --- a/src/shared/proparser/qmakevfs.cpp +++ b/src/shared/proparser/qmakevfs.cpp @@ -32,6 +32,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 @@ -42,6 +46,9 @@ QMakeVfs::QMakeVfs() , m_magicExisting(fL1S("existing")) #endif { +#ifndef QT_NO_TEXTCODEC + m_textCodec = 0; +#endif } bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, VfsFlags flags, @@ -184,7 +191,11 @@ QMakeVfs::ReadResult QMakeVfs::readFile( *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; } @@ -242,4 +253,11 @@ void QMakeVfs::invalidateContents() } #endif +#ifndef QT_NO_TEXTCODEC +void QMakeVfs::setTextCodec(const QTextCodec *textCodec) +{ + m_textCodec = textCodec; +} +#endif + QT_END_NAMESPACE |