gocarina / gocsv

The GoCSV package aims to provide easy CSV serialization and deserialization to the golang programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tab Delimited Files - Issues processing

bovinemagnet opened this issue · comments

commented

When testing, I was able to reproduce what looks like a bug in the delimiter selecting.

If I run the simple.csv file included with the code, I get:

./gocsv view test-files/simple.csv
+----------------------------+-----------------+
| Name                       | Website         |
+----------------------------+-----------------+
| DataFox Intelligence, Inc. | www.datafox.com |
+----------------------------+-----------------+

If I create a copy of simple.csv as simple.tsv, replacing the column commas with tabs, I get an error.

./gocsv view test-files/simple.tsv
Error: parse error on line 2, column 27: extraneous or missing " in quoted-field

The file simple.tsv is just a copy of simple.csv but with tabs instead of commas.

If I remove the quotes, I get

./gocsv view test-files/simple2.tsv
Error: record on line 2: wrong number of fields

If I remove the quotes and comma, I get success with a tab delimited file.

./gocsv view test-files/simple3.tsv
+-------------------------------------------+
| Name	Website                              |
+-------------------------------------------+
| Data Fox Intelligence Inc	www.datafox.com |
+-------------------------------------------+

simple.tsv

Name	Website
"Data Fox Intelligence, Inc"	www.datafox.com

simple2.tsv

Name	Website
Data Fox Intelligence, Inc	www.datafox.com

simple3.tsv

Name	Website
Data Fox Intelligence Inc	www.datafox.com

I just ran into the same issue.