File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 27
27
#include < QFile>
28
28
#include < QMessageBox>
29
29
#include < QFileDialog>
30
+ #include < QTextStream>
30
31
31
32
#include < climits>
32
33
#include < cfloat>
@@ -120,21 +121,25 @@ void QgsAttributeTypeDialog::loadFromCSVButtonPushed()
120
121
{
121
122
QMessageBox::information ( NULL ,
122
123
tr ( " Error" ),
123
- tr ( " Could not open file %1\n Error was:%2" ).arg ( fileName ).arg ( f.errorString () ), QMessageBox::Cancel );
124
+ tr ( " Could not open file %1\n Error was:%2" ).arg ( fileName ).arg ( f.errorString () ),
125
+ QMessageBox::Cancel );
124
126
return ;
125
127
}
126
128
129
+ QTextStream s (&f);
130
+ s.setAutoDetectUnicode (true );
131
+
127
132
QRegExp re0 ( " ^([^;]*);(.*)$" );
128
133
re0.setMinimal ( true );
129
134
QRegExp re1 ( " ^([^,]*),(.*)$" );
130
135
re1.setMinimal ( true );
131
136
QMap<QString, QVariant> map;
132
137
133
- f .readLine ();
138
+ s .readLine ();
134
139
135
- while ( !f .atEnd () )
140
+ while ( !s .atEnd () )
136
141
{
137
- QString l = f .readLine ().trimmed ();
142
+ QString l = s .readLine ().trimmed ();
138
143
139
144
QString key, val;
140
145
if ( re0.indexIn ( l ) >= 0 && re0.numCaptures () == 2 )
You can’t perform that action at this time.
0 commit comments