Mercurial > hg > sonic-visualiser
diff main/MainWindow.cpp @ 911:c08df7de50f6
Specify UTF-8 encoding when writing XML formats -- the XML header always indicated UTF-8 but the QTextStream defaulted to local encoding which is generally not UTF-8 on Windows
author | Chris Cannam |
---|---|
date | Mon, 02 Mar 2015 17:20:24 +0000 |
parents | 35ce47084c84 |
children | 096634fc3f19 |
line wrap: on
line diff
--- a/main/MainWindow.cpp Thu Feb 26 09:44:08 2015 +0000 +++ b/main/MainWindow.cpp Mon Mar 02 17:20:24 2015 +0000 @@ -108,6 +108,7 @@ #include <QFileInfo> #include <QDir> #include <QTextStream> +#include <QTextCodec> #include <QProcess> #include <QShortcut> #include <QSettings> @@ -2726,6 +2727,7 @@ error = tr("Failed to open file %1 for writing").arg(path); } else { QTextStream out(&file); + out.setCodec(QTextCodec::codecForName("UTF-8")); out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" << "<!DOCTYPE sonic-visualiser>\n" << "<sv>\n"