Skip to content

Commit 1aa9485

Browse files
rouaultnyalldawson
authored andcommitted
[OGR provider] Fix deletion of layers from QGIS browser when filename has non-ASCII characters (fixes https://issues.qgis.org/issues/19861)
1 parent 7c6cb91 commit 1aa9485

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/providers/ogr/qgsogrprovider.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6275,7 +6275,7 @@ QGISEXTERN bool deleteLayer( const QString &uri, QString &errCause )
62756275
ogrGeometryType );
62766276

62776277

6278-
GDALDatasetH hDS = GDALOpenEx( filePath.toLocal8Bit().data(), GDAL_OF_RASTER | GDAL_OF_VECTOR | GDAL_OF_UPDATE, nullptr, nullptr, nullptr );
6278+
GDALDatasetH hDS = GDALOpenEx( filePath.toUtf8().constData(), GDAL_OF_RASTER | GDAL_OF_VECTOR | GDAL_OF_UPDATE, nullptr, nullptr, nullptr );
62796279
if ( hDS && ( ! layerName.isEmpty() || layerIndex != -1 ) )
62806280
{
62816281
// If we have got a name we convert it into an index
@@ -6285,7 +6285,7 @@ QGISEXTERN bool deleteLayer( const QString &uri, QString &errCause )
62856285
for ( int i = 0; i < GDALDatasetGetLayerCount( hDS ); i++ )
62866286
{
62876287
OGRLayerH hL = GDALDatasetGetLayer( hDS, i );
6288-
if ( layerName == QString( OGR_L_GetName( hL ) ) )
6288+
if ( layerName == QString::fromUtf8( OGR_L_GetName( hL ) ) )
62896289
{
62906290
layerIndex = i;
62916291
break;

0 commit comments

Comments
 (0)