Comment 0 for bug 1714760

Revision history for this message
negora (negora) wrote : Wrong output when escaping double quotes

Hello:

I'm using "csvtool" to get a column from a CSV file, with the subcommand "col". This file has one column with escaped double quotes that makes this command to return the wrong output. There are escaped quotes at the beginning of the column, in the middle, and at the end. But "csvtool" doesn't remove the double quotes that surround the column (the non-escaped ones), nor un-escapes the escaped quotes (it should transform "" to ").

Suppose that you have a file called "test.csv" with this single line:

  "foo","""Hello "" World!""","bar"

It has 3 columns, all them quoted. The one in the middle has 3 double double-quotes (escaped quotes).

When I execute these commands, I expect the following output:

  $ csvtool col 1 test.csv
  for

  $ csvtool col 2 test.csv
  "Hello " World!"

  $ csvtool col 3 test.csv
  bar

But I get this output:

  $ csvtool col 1 test.csv
  for

  $ csvtool col 2 test.csv
  """Hello "" World!"""

  $ csvtool col 3 test.csv
  bar

"csvtool" seems to return the 2nd column as is, without any transformation.

This is the information of my current Debian install:

  * Distribution: Ubuntu 16.04.3 LTS
 * Architecture: amd64
  * Kernel: 4.4.0-92.115
  * libc6: 2.23-0ubuntu9
  * csvtool: 1.4.2-1

Thank you.