comparison 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
comparison
equal deleted inserted replaced
416:7b2dd0d4c366 432:9876a1db566c
88 #include <QTreeView> 88 #include <QTreeView>
89 #include <QFile> 89 #include <QFile>
90 #include <QFileInfo> 90 #include <QFileInfo>
91 #include <QDir> 91 #include <QDir>
92 #include <QTextStream> 92 #include <QTextStream>
93 #include <QTextCodec>
93 #include <QProcess> 94 #include <QProcess>
94 #include <QShortcut> 95 #include <QShortcut>
95 #include <QSettings> 96 #include <QSettings>
96 #include <QDateTime> 97 #include <QDateTime>
97 #include <QProcess> 98 #include <QProcess>
2233 } 2234 }
2234 2235
2235 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 2236 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2236 2237
2237 QTextStream out(&bzFile); 2238 QTextStream out(&bzFile);
2239 out.setCodec(QTextCodec::codecForName("UTF-8"));
2238 toXml(out, false); 2240 toXml(out, false);
2239 out.flush(); 2241 out.flush();
2240 2242
2241 QApplication::restoreOverrideCursor(); 2243 QApplication::restoreOverrideCursor();
2242 2244
2278 } 2280 }
2279 2281
2280 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 2282 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2281 2283
2282 QTextStream out(&file); 2284 QTextStream out(&file);
2285 out.setCodec(QTextCodec::codecForName("UTF-8"));
2283 toXml(out, true); 2286 toXml(out, true);
2284 out.flush(); 2287 out.flush();
2285 2288
2286 QApplication::restoreOverrideCursor(); 2289 QApplication::restoreOverrideCursor();
2287 2290