mirror of https://github.com/vitalif/openscad
Explicitly use UTF-8 as file encoding to avoid Windows automatically falling back to cp1252. Fixes #223
parent
b04734cbf5
commit
c0612a9ed0
|
@ -588,7 +588,9 @@ void MainWindow::refreshDocument()
|
||||||
this->fileName.toStdString() % file.errorString().toStdString());
|
this->fileName.toStdString() % file.errorString().toStdString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString text = QTextStream(&file).readAll();
|
QTextStream reader(&file);
|
||||||
|
reader.setCodec("UTF-8");
|
||||||
|
QString text = reader.readAll();
|
||||||
PRINTB("Loaded design '%s'.", this->fileName.toStdString());
|
PRINTB("Loaded design '%s'.", this->fileName.toStdString());
|
||||||
editor->setPlainText(text);
|
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());
|
PRINTB("Failed to open file for writing: %s (%s)", this->fileName.toStdString() % file.errorString().toStdString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QTextStream(&file) << this->editor->toPlainText();
|
QTextStream writer(&file);
|
||||||
|
writer.setCodec("UTF-8");
|
||||||
|
writer << this->editor->toPlainText();
|
||||||
PRINTB("Saved design '%s'.", this->fileName.toStdString());
|
PRINTB("Saved design '%s'.", this->fileName.toStdString());
|
||||||
this->editor->setContentModified(false);
|
this->editor->setContentModified(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue