[QGIS Commit] r11833 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Oct 24 16:33:56 EDT 2009


Author: jef
Date: 2009-10-24 16:33:56 -0400 (Sat, 24 Oct 2009)
New Revision: 11833

Modified:
   trunk/qgis/src/app/qgsattributetypedialog.cpp
Log:
fix #2029

Modified: trunk/qgis/src/app/qgsattributetypedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributetypedialog.cpp	2009-10-24 20:33:40 UTC (rev 11832)
+++ trunk/qgis/src/app/qgsattributetypedialog.cpp	2009-10-24 20:33:56 UTC (rev 11833)
@@ -27,6 +27,7 @@
 #include <QFile>
 #include <QMessageBox>
 #include <QFileDialog>
+#include <QTextStream>
 
 #include <climits>
 #include <cfloat>
@@ -120,21 +121,25 @@
   {
     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<QString, QVariant> 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 )



More information about the QGIS-commit mailing list