comparison runner/LabFeatureWriter.cpp @ 189:089f1a13963d

Require (and provide) text codec for output stream -- fixing #1153 (wrong codec used when writing RDF)
author Chris Cannam
date Mon, 02 Mar 2015 17:17:59 +0000
parents 59abb58b1855
children 704a8b27f3ed
comparison
equal deleted inserted replaced
188:cbbf8a838b47 189:089f1a13963d
21 21
22 #include <iostream> 22 #include <iostream>
23 23
24 #include <QRegExp> 24 #include <QRegExp>
25 #include <QTextStream> 25 #include <QTextStream>
26 #include <QTextCodec>
26 27
27 using namespace std; 28 using namespace std;
28 using namespace Vamp; 29 using namespace Vamp;
29 30
30 LabFeatureWriter::LabFeatureWriter() : 31 LabFeatureWriter::LabFeatureWriter() :
83 // Select appropriate output file for our track/transform 84 // Select appropriate output file for our track/transform
84 // combination 85 // combination
85 86
86 TransformId transformId = transform.getIdentifier(); 87 TransformId transformId = transform.getIdentifier();
87 88
88 QTextStream *sptr = getOutputStream(trackId, transformId); 89 QTextStream *sptr = getOutputStream
90 (trackId, transformId, QTextCodec::codecForName("UTF-8"));
89 if (!sptr) { 91 if (!sptr) {
90 throw FailedToOpenOutputStream(trackId, transformId); 92 throw FailedToOpenOutputStream(trackId, transformId);
91 } 93 }
92 94
93 QTextStream &stream = *sptr; 95 QTextStream &stream = *sptr;
119 { 121 {
120 for (PendingFeatures::const_iterator i = m_pending.begin(); 122 for (PendingFeatures::const_iterator i = m_pending.begin();
121 i != m_pending.end(); ++i) { 123 i != m_pending.end(); ++i) {
122 DataId tt = i->first; 124 DataId tt = i->first;
123 Plugin::Feature f = i->second; 125 Plugin::Feature f = i->second;
124 QTextStream *sptr = getOutputStream(tt.first, tt.second.getIdentifier()); 126 QTextStream *sptr = getOutputStream
127 (tt.first, tt.second.getIdentifier(),
128 QTextCodec::codecForName("UTF-8"));
125 if (!sptr) { 129 if (!sptr) {
126 throw FailedToOpenOutputStream(tt.first, tt.second.getIdentifier()); 130 throw FailedToOpenOutputStream(tt.first, tt.second.getIdentifier());
127 } 131 }
128 QTextStream &stream = *sptr; 132 QTextStream &stream = *sptr;
129 // final feature has its own time as end time (we can't 133 // final feature has its own time as end time (we can't