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 2727#include < QFile>
2828#include < QMessageBox>
2929#include < QFileDialog>
30+ #include < QTextStream>
3031
3132#include < climits>
3233#include < cfloat>
@@ -120,21 +121,25 @@ void QgsAttributeTypeDialog::loadFromCSVButtonPushed()
120121 {
121122 QMessageBox::information ( NULL ,
122123 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 );
124126 return ;
125127 }
126128
129+ QTextStream s (&f);
130+ s.setAutoDetectUnicode (true );
131+
127132 QRegExp re0 ( " ^([^;]*);(.*)$" );
128133 re0.setMinimal ( true );
129134 QRegExp re1 ( " ^([^,]*),(.*)$" );
130135 re1.setMinimal ( true );
131136 QMap<QString, QVariant> map;
132137
133- f .readLine ();
138+ s .readLine ();
134139
135- while ( !f .atEnd () )
140+ while ( !s .atEnd () )
136141 {
137- QString l = f .readLine ().trimmed ();
142+ QString l = s .readLine ().trimmed ();
138143
139144 QString key, val;
140145 if ( re0.indexIn ( l ) >= 0 && re0.numCaptures () == 2 )
You can’t perform that action at this time.
0 commit comments