csv icon indicating copy to clipboard operation
csv copied to clipboard

change \r\n as default for eol

Open close2 opened this issue 9 years ago • 2 comments

Far too many documents use the system eol encoding.

It shouldn't be a problem to accept both.

close2 avatar Feb 05 '16 16:02 close2

I'm having a huge issue with eol and this library. I was with you on sticking with the RFC eol as CRLF but I am having 0% success rate. I am on a Mac and I have downloaded csv files from census.org, github, linkedin, and created my own and all of them were LF (except one was CR – weird). So I think the RFC is wrong on this one. Please either make it default to system or auto-detect. "It shouldn't be a problem to accept both." You mean, accept all three? I did run into a CR file today. I thought these files went extinct. If you don't do CR I won't blame you ;)

Zectbumo avatar May 20 '16 00:05 Zectbumo

I was reading PEP 278 how Python ran into a similar issue. When I think of something good that accepts all EOLs I think of Python Universal Newlines. The PEP referenced the issue and I looked at the diff. Something that I thought was interesting was the PEP mentions universal newlines only work for input files. So if the Dart CSV lib is going to output a csv file then I think the default should be system eol. Reading a csv file should be universal newlines by default. From the looks of the diff it seems that the whole file is scanned and all EOLs used in the file are gathered into a list. I'm not sure this is going to be useful to an end user of this Dart CSV lib but keeping a list of all line endings for the lib users might be something worth considering.

Zectbumo avatar May 20 '16 01:05 Zectbumo