Skip to content

Commit

Permalink
[OGR provider] Fix deletion of layers from QGIS browser when filename…
Browse files Browse the repository at this point in the history
… has non-ASCII characters (fixes https://issues.qgis.org/issues/19861)
  • Loading branch information
rouault authored and nyalldawson committed Oct 7, 2018
1 parent 7c6cb91 commit 1aa9485
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/providers/ogr/qgsogrprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 1aa9485

Please sign in to comment.