Skip to content
Permalink
Browse files

[OGR provider] Fix deletion of layers from QGIS browser when filename…

… has non-ASCII characters (fixes https://issues.qgis.org/issues/19861)
  • Loading branch information
rouault authored and nyalldawson committed Oct 6, 2018
1 parent 7c6cb91 commit 1aa9485f6db243431ab7efe30599df44ab26f352
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/providers/ogr/qgsogrprovider.cpp
@@ -6275,7 +6275,7 @@ QGISEXTERN bool deleteLayer( const QString &uri, QString &errCause )
ogrGeometryType );


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

0 comments on commit 1aa9485

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