Skip to content
Permalink
Browse files

fix #3945 (following up on r15148)

git-svn-id: http://svn.osgeo.org/qgis/trunk@15178 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Feb 16, 2011
1 parent 2464884 commit 98d204b7dcc063582721eecacd1f63b35f73c663
Showing with 12 additions and 4 deletions.
  1. +10 −2 src/core/qgsvectorfilewriter.cpp
  2. +2 −2 src/providers/ogr/qgsogrprovider.cpp
@@ -42,6 +42,14 @@
#include <cpl_error.h>
#include <cpl_conv.h>

#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
#define TO8(x) (x).toUtf8().constData()
#define TO8F(x) (x).toUtf8().constData()
#else
#define TO8(x) (x).toLocal8Bit().constData()
#define TO8F(x) QFile::encodeName( x ).constData()
#endif


QgsVectorFileWriter::QgsVectorFileWriter(
const QString &theVectorFileName,
@@ -144,7 +152,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
}

// create the data source
mDS = OGR_Dr_CreateDataSource( poDriver, vectorFileName.toLocal8Bit().data(), options );
mDS = OGR_Dr_CreateDataSource( poDriver, TO8( vectorFileName ), options );

if ( options )
{
@@ -202,7 +210,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
options[ layerOptions.size()] = NULL;
}

mLayer = OGR_DS_CreateLayer( mDS, QFile::encodeName( layerName ).data(), ogrRef, wkbType, options );
mLayer = OGR_DS_CreateLayer( mDS, TO8F( layerName ), ogrRef, wkbType, options );

if ( options )
{
@@ -1622,7 +1622,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
}

OGRDataSourceH dataSource;
dataSource = OGR_Dr_CreateDataSource( driver, QFile::encodeName( uri ).constData(), NULL );
dataSource = OGR_Dr_CreateDataSource( driver, TO8F( uri ), NULL );
if ( dataSource == NULL )
{
return false;
@@ -1679,7 +1679,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
}

OGRLayerH layer;
layer = OGR_DS_CreateLayer( dataSource, QFile::encodeName( QFileInfo( uri ).completeBaseName() ).constData(), reference, OGRvectortype, NULL );
layer = OGR_DS_CreateLayer( dataSource, TO8F( QFileInfo( uri ).completeBaseName() ), reference, OGRvectortype, NULL );
if ( layer == NULL )
{
return false;

0 comments on commit 98d204b

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