Skip to content

Commit dc5e2b7

Browse files
committed
GUI - set file encoding to UTF-8 when loading files
It's now possible to take an example UTF-8 file, paste it into Sonic Pi's GUI, save it to disk then load it from disk and see it rendered the same on Windows.
1 parent 33eb594 commit dc5e2b7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/gui/qt/mainwindow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3317,8 +3317,10 @@ void MainWindow::loadFile(const QString& fileName, SonicPiScintilla*& text)
33173317
}
33183318

33193319
QTextStream in(&file);
3320+
in.setCodec("UTF-8");
33203321
QApplication::setOverrideCursor(Qt::WaitCursor);
33213322
text->setText(in.readAll());
3323+
file.close();
33223324
QApplication::restoreOverrideCursor();
33233325
statusBar()->showMessage(tr("File loaded..."), 2000);
33243326
}

0 commit comments

Comments
 (0)