Skip to content
Permalink
Browse files

vector provider: fetch codec list from Qt and default to System when …

…a unavailable codecs is requested (might cure issueID #4801)
  • Loading branch information
jef-n committed Jan 14, 2012
1 parent 50cdcc3 commit 89306335ae6a6dda262f6184d350b44ca6a6192b
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/core/qgsvectordataprovider.cpp
@@ -23,6 +23,7 @@
#include "qgsfeature.h"
#include "qgsfield.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"

QgsVectorDataProvider::QgsVectorDataProvider( QString uri )
: QgsDataProvider( uri )
@@ -157,7 +158,9 @@ void QgsVectorDataProvider::setEncoding( const QString& e )
}
else
{
QgsDebugMsg( "error finding QTextCodec for " + e );
QgsMessageLog::logMessage( tr( "Codec %1 not found. Falling back to system locale" ).arg( e ) );
mEncoding = QTextCodec::codecForName( "System" );
Q_ASSERT( mEncoding );
}
}

@@ -457,6 +460,12 @@ const QStringList &QgsVectorDataProvider::availableEncodings()
{
if ( smEncodings.isEmpty() )
{
foreach( QString codec, QTextCodec::availableCodecs() )
{
smEncodings << codec;
}
qSort( smEncodings );
#if 0
smEncodings << "BIG5";
smEncodings << "BIG5-HKSCS";
smEncodings << "EUCJP";
@@ -502,6 +511,7 @@ const QStringList &QgsVectorDataProvider::availableEncodings()
smEncodings << "Apple Roman";
smEncodings << "TIS-620";
smEncodings << "System";
#endif
}

return smEncodings;

0 comments on commit 8930633

Please sign in to comment.
You can’t perform that action at this time.