changeset 432:9876a1db566c

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:23 +0000
parents 7b2dd0d4c366
children 720f732e8082 2185d52b4758 12d982e52190
files framework/MainWindowBase.cpp
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Mon Sep 29 13:27:13 2014 +0100
+++ b/framework/MainWindowBase.cpp	Mon Mar 02 17:20:23 2015 +0000
@@ -90,6 +90,7 @@
 #include <QFileInfo>
 #include <QDir>
 #include <QTextStream>
+#include <QTextCodec>
 #include <QProcess>
 #include <QShortcut>
 #include <QSettings>
@@ -2235,6 +2236,7 @@
         QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 
         QTextStream out(&bzFile);
+        out.setCodec(QTextCodec::codecForName("UTF-8"));
         toXml(out, false);
         out.flush();
 
@@ -2280,6 +2282,7 @@
         QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 
         QTextStream out(&file);
+        out.setCodec(QTextCodec::codecForName("UTF-8"));
         toXml(out, true);
         out.flush();