[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#874104: csvtool: wrong output when escaping double quotes.



Package: csvtool
Version: 1:52.2.1-4~deb9u1

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: Debian GNU/Linux 9.1 (stretch)
  * Kernel: Linux 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3
(2017-08-06) x86_64 GNU/Linux
  * libc6: 2.24-11+deb9u1
  * csvtool: 1:52.2.1-4~deb9u1

Thank you.


Reply to: