diff framework/MainWindowBase.cpp @ 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 a39a7d6b0f2d
children dee4aceb131c
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();