Skip to content

Commit

Permalink
Fix for #6309, add case-insensitive sort for vector provider encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto committed Sep 6, 2012
1 parent 24d50e4 commit 652deba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/qgsvectordataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ QVariant QgsVectorDataProvider::convertValue( QVariant::Type type, QString value
return v;
}

static bool _compareEncodings( const QString& s1, const QString& s2 )
{
return s1.toLower() < s2.toLower();
}

const QStringList &QgsVectorDataProvider::availableEncodings()
{
if ( smEncodings.isEmpty() )
Expand All @@ -468,7 +473,6 @@ const QStringList &QgsVectorDataProvider::availableEncodings()
{
smEncodings << codec;
}
qSort( smEncodings );
#if 0
smEncodings << "BIG5";
smEncodings << "BIG5-HKSCS";
Expand Down Expand Up @@ -518,6 +522,9 @@ const QStringList &QgsVectorDataProvider::availableEncodings()
#endif
}

// Do case-insensitive sorting of encodings
qSort( smEncodings.begin(), smEncodings.end(), _compareEncodings );

return smEncodings;
}

Expand Down

0 comments on commit 652deba

Please sign in to comment.