1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

Fix incompatible encoding names in ContentModel (bug uncovered by 41c17bccb6)

This commit is contained in:
scrawl 2014-07-17 20:40:40 +02:00
parent f9a39138cc
commit 4d39d77eaa
2 changed files with 3 additions and 1 deletions

View file

@ -23,6 +23,7 @@ ContentSelectorModel::ContentModel::ContentModel(QObject *parent) :
void ContentSelectorModel::ContentModel::setEncoding(const QString &encoding)
{
mEncoding = encoding;
if (encoding == QLatin1String("win1252"))
mCodec = QTextCodec::codecForName("windows-1252");
@ -449,7 +450,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
try {
ESM::ESMReader fileReader;
ToUTF8::Utf8Encoder encoder =
ToUTF8::calculateEncoding(QString(mCodec->name()).toStdString());
ToUTF8::calculateEncoding(mEncoding.toStdString());
fileReader.setEncoder(&encoder);
fileReader.open(dir.absoluteFilePath(path).toStdString());

View file

@ -64,6 +64,7 @@ namespace ContentSelectorModel
ContentFileList mFiles;
QHash<QString, Qt::CheckState> mCheckStates;
QTextCodec *mCodec;
QString mEncoding;
public: