Commit 32fdfe9a authored by Gil Moskowitz's avatar Gil Moskowitz

Merge pull request #56 from davidbeauchamp/master

Fixes issue #15457 - textstreams saved as UTF-8 on windows were not written with BOM
parents 819f59cf 4bc75e96
......@@ -333,6 +333,11 @@ bool MQLEdit::save()
if (file.open(QIODevice::WriteOnly))
{
QTextStream stream(&file);
stream.setCodec("UTF-8");
#ifdef Q_OS_WIN
// bug #15457 Saving UTF files on windows does not write BOM
stream.setGenerateByteOrderMark(true);
#endif
stream << _text->toPlainText();
}
else
......
......@@ -1061,6 +1061,10 @@ bool DocumentScene::save(QIODevice * iod, QWidget * parent)
// now write it to the file
QTextStream ts(iod);
ts.setCodec("UTF-8");
#ifdef Q_OS_WIN
// bug #15457 Saving UTF files on windows does not write BOM
ts.setGenerateByteOrderMark(true);
#endif
ts << document().toString();
iod->close();
lastSaveToDb = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment