CyrusOfEden / CSV.js

A simple, blazing-fast CSV parser and encoder. Full RFC 4180 compliance.
MIT License
1.54k stars 95 forks source link

Option to not ignore empty lines #33

Closed muzuiget closed 8 years ago

muzuiget commented 8 years ago

I don't know why this commit is a bug should be fix, so v3.6.4 is a breaking change and break my code, and let me busy this morning :cry:

If ignore empty lines, we can’t one-to-one align the row index between parsing code and csv editor. For example, I generate a csv let use to edit, and use a empty line separate each section for for pretty look.

"title"
"desc"
"command"
"" <- as a separator
"User ID"
"integer"
"uid"
"1234"

When parse back the csv, if ignore the empty lines, I need to shift the row index, it is hard to debug because the rows which return by parse(), the array index is different from csv editor.

So, I request a option the let me setting this behavior.

CyrusOfEden commented 8 years ago

Because this isn't part of the spec for CSV. The line separator is \r\n or \r or \n.

muzuiget commented 8 years ago

It is not \r\n\r\n, is \r\n""\r\n, which have an double quote between them.

And Python standard library csv module will keep these lines as well.