Skip to content

Commit

Permalink
Always set "SHAPE_ENCODING" GDAL config option to "" in QgsVectorFile…
Browse files Browse the repository at this point in the history
…Writer (follows up commit:c0551a6)
  • Loading branch information
borysiasty committed Apr 25, 2013
1 parent 89f34b2 commit 320d90a
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/core/qgsvectorfilewriter.cpp
Expand Up @@ -109,25 +109,14 @@ QgsVectorFileWriter::QgsVectorFileWriter(
return;
}

QSettings settings;

if ( driverName == "ESRI Shapefile" )
{
if ( layOptions.join( "" ).toUpper().indexOf( "ENCODING=" ) == -1 )
{
layOptions.append( "ENCODING=" + fileEncoding );
}

if ( settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() )
{
CPLSetConfigOption( "SHAPE_ENCODING", "" );
}
else
{
CPLSetConfigOption( "SHAPE_ENCODING", fileEncoding.toLocal8Bit().data() );
// WARNING!! If SHAPE_ENCODING and -lco ENCODING are used, the fileEncoding must be set to the layer internal encoding!!
fileEncoding = "UTF-8";
}
CPLSetConfigOption( "SHAPE_ENCODING", "" );

if ( !vectorFileName.endsWith( ".shp", Qt::CaseInsensitive ) &&
!vectorFileName.endsWith( ".dbf", Qt::CaseInsensitive ) )
Expand Down Expand Up @@ -235,6 +224,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
{
QgsDebugMsg( "error finding QTextCodec for " + fileEncoding );

QSettings settings;
QString enc = settings.value( "/UI/encoding", "System" ).toString();
mCodec = QTextCodec::codecForName( enc.toLocal8Bit().constData() );
if ( !mCodec )
Expand Down

0 comments on commit 320d90a

Please sign in to comment.