Skip to content

Commit

Permalink
Fallback to UTF-8 when no encoding is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
YoannQDQ authored and nyalldawson committed Apr 24, 2023
1 parent 1c1e460 commit 49b3a9d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/vector/qgsvectordataprovider.cpp
Expand Up @@ -264,7 +264,15 @@ void QgsVectorDataProvider::setEncoding( const QString &e )
{
QGIS_PROTECT_QOBJECT_THREAD_ACCESS

mEncoding = QTextCodec::codecForName( e.toLocal8Bit().constData() );
// Use UTF-8 if no encoding is specified
if ( e.isEmpty() )
{
mEncoding = QTextCodec::codecForName( "UTF-8" );
}
else
{
mEncoding = QTextCodec::codecForName( e.toLocal8Bit().constData() );
}
if ( !mEncoding && e != QLatin1String( "System" ) )
{
if ( !e.isEmpty() )
Expand Down

0 comments on commit 49b3a9d

Please sign in to comment.