diff options
author | Marius Kintel <marius@kintel.net> | 2012-12-08 08:53:53 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-12-08 08:53:53 (GMT) |
commit | c0612a9ed0899c96963e04c848a59b0164a689a2 (patch) | |
tree | 066ad1862490b03a6f11727efcf26873a72806f8 | |
parent | b04734cbf57db78d188cff9de9a4e33b2366534b (diff) |
Explicitly use UTF-8 as file encoding to avoid Windows automatically falling back to cp1252. Fixes #223
-rw-r--r-- | src/mainwin.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index 4b0df70..dc5b79b 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -588,7 +588,9 @@ void MainWindow::refreshDocument() this->fileName.toStdString() % file.errorString().toStdString()); } else { - QString text = QTextStream(&file).readAll(); + QTextStream reader(&file); + reader.setCodec("UTF-8"); + QString text = reader.readAll(); PRINTB("Loaded design '%s'.", this->fileName.toStdString()); editor->setPlainText(text); } @@ -900,7 +902,9 @@ void MainWindow::actionSave() PRINTB("Failed to open file for writing: %s (%s)", this->fileName.toStdString() % file.errorString().toStdString()); } else { - QTextStream(&file) << this->editor->toPlainText(); + QTextStream writer(&file); + writer.setCodec("UTF-8"); + writer << this->editor->toPlainText(); PRINTB("Saved design '%s'.", this->fileName.toStdString()); this->editor->setContentModified(false); } |