changeset 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 d0b89689f2b4
children fbe7565f4ce6
files .hgsubstate main/MainWindow.cpp
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Thu Feb 26 09:44:08 2015 +0000
+++ b/.hgsubstate	Mon Mar 02 17:20:24 2015 +0000
@@ -1,5 +1,5 @@
 d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay
 879bdc878826bebec67130326f99397c430419b1 sv-dependency-builds
-7b2dd0d4c366057ce25547a4015f3a76981abedc svapp
+9876a1db566c30398da9c1d751eadbbbee10d495 svapp
 780959a4fe23619a2efdfaaa2414e9f3ec18045f svcore
 78e041e45ff0ff3c103e0d794c6f66f391020aff svgui
--- 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"