diff --git a/src/app/qgsattributetypedialog.cpp b/src/app/qgsattributetypedialog.cpp index 4c2cd1fd69c1..137218c70879 100644 --- a/src/app/qgsattributetypedialog.cpp +++ b/src/app/qgsattributetypedialog.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -120,21 +121,25 @@ void QgsAttributeTypeDialog::loadFromCSVButtonPushed() { QMessageBox::information( NULL, tr( "Error" ), - tr( "Could not open file %1\nError was:%2" ).arg( fileName ).arg( f.errorString() ), QMessageBox::Cancel ); + tr( "Could not open file %1\nError was:%2" ).arg( fileName ).arg( f.errorString() ), + QMessageBox::Cancel ); return; } + QTextStream s(&f); + s.setAutoDetectUnicode(true); + QRegExp re0( "^([^;]*);(.*)$" ); re0.setMinimal( true ); QRegExp re1( "^([^,]*),(.*)$" ); re1.setMinimal( true ); QMap map; - f.readLine(); + s.readLine(); - while ( !f.atEnd() ) + while ( !s.atEnd() ) { - QString l = f.readLine().trimmed(); + QString l = s.readLine().trimmed(); QString key, val; if ( re0.indexIn( l ) >= 0 && re0.numCaptures() == 2 )