Skip to content

Commit 302529a

Browse files
authoredOct 24, 2018
Merge pull request #8289 from borysiasty/csv_string_quoting
[needs-docs] Save layer as CSV: add STRING_QUOTING option to the predefined drop-down widgets
2 parents 745526d + 61ebc18 commit 302529a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎src/core/qgsvectorfilewriter.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,17 @@ class QgsVectorFileWriterMetadataContainer
843843
QStringLiteral( "COMMA" ) // Default value
844844
) );
845845

846+
#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,3,0)
847+
layerOptions.insert( QStringLiteral( "STRING_QUOTING" ), new QgsVectorFileWriter::SetOption(
848+
QObject::tr( "Double-quote strings. IF_AMBIGUOUS means that string values that look like numbers will be quoted." ),
849+
QStringList()
850+
<< QStringLiteral( "IF_NEEDED" )
851+
<< QStringLiteral( "IF_AMBIGUOUS" )
852+
<< QStringLiteral( "ALWAYS" ),
853+
QStringLiteral( "IF_AMBIGUOUS" ) // Default value
854+
) );
855+
#endif
856+
846857
layerOptions.insert( QStringLiteral( "WRITE_BOM" ), new QgsVectorFileWriter::BoolOption(
847858
QObject::tr( "Write a UTF-8 Byte Order Mark (BOM) at the start of the file." ),
848859
false // Default value

0 commit comments

Comments
 (0)
Please sign in to comment.