Ticket #2136 (closed enhancement: fixed)

Opened 5 years ago

Last modified 4 years ago

CSV driver specific dataset creation option "SEPARATOR=SEMICOLON"

Reported by: sfkeller Owned by: rouault
Priority: normal Milestone: 1.7.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: csv seperator
Cc: warmerdam

Description

Currently the CSV writer outputs commas (",") as field value separators (or delimiters). This follows "best practices" of CSV but fails to serve MS Excel as expected. In order to support also a non-negligible amount of Windows (and Mac) users I suggest to be able to specify also semicolon or tab as separator.

Proposal: CSV driver specific dataset creation option for field value separators, called SEPARATOR where commas are the default. This may be overridden through use of the dataset creation option SEPARATOR which may have a value of COMMA, SEMICOLON, or TAB. Example: ogr2ogr -f CSV -dsco SEPARATOR=SEMICOLON out myfile.shp

Change History

Changed 5 years ago by sfkeller

  • component changed from default to OGR_SF

Changed 5 years ago by Monty

  • keywords csv seperator added

I also need the Semicolon Seperator, for Fileimports to Openoffice and other spreadsheet application. Replace , for ; dont work realy.

Changed 4 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.7.0

In r16759, add support for reading and writing CSV files with semicolon or tabulation as the field separator. Test added in r16760

Changed 4 years ago by warmerdam

  • status changed from closed to reopened
  • resolution fixed deleted

Even,

I'm quite nervous that you have changed the core csv code autodetect separators. This seems risky. Given that you are doing so, I would prefer that it default to the original behavior (using the comma). I would also suggest that CSVDetectSeperator should understand csv style quoting so it doesn't pick up delimiters that are within a quoted string in the file.

Changed 4 years ago by warmerdam

  • cc warmerdam added
  • owner changed from warmerdam to rouault
  • status changed from reopened to new

Changed 4 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed

r16752: "Partial revert of r16759 so we don't use separator autodetection for core CSV code, but only for new API CSVReadParseLine2(); Improve CSVDetectSeperator() to understand CSV quoting"

Changed 4 years ago by rouault

grr, the right revision is r16762

Note: See TracTickets for help on using tickets.