ods icon indicating copy to clipboard operation
ods copied to clipboard

Line Separators for CSV files don't have an effect

Open MBuchalik opened this issue 3 years ago • 0 comments

It seems like the setting "lineSeparator" for CSV files has no effect.

I loaded two CSV files using the Adapter (the "preview" endpoint). One file has LF line endings and the other one uses CRLF. For both files, no matter if I set "lineSeparator" to LF or CRLF, I get the exact same response from the server.

The file looks like this:

column1,column2,column3
first,second,third
fourth,fifth,sixth

Expected result

I would expect some kind of error message from the server if the selected line ending does not match the one the server got from the data source.

Actual result

I always get the exact same response from the server, looking like this:

{"id":123,"data":"[[\"column1\",\"column2\",\"column3\"],[\"first\",\"second\",\"third\"],[\"fourth\",\"fifth\",\"sixth\"]]"}

Here are two sample CSV files for you to try it out: csv-files.zip

Possible solutions

From my point of view, it would be really nice if we could simply drop the "lineSeparator" setting. This would reduce the amount of work the user has to do when configuring a data source. Also, it would allow loading files with mixed line endings. (Not sure if this is really a thing, but imagine a user opened a LF file with a bad editor in Windows and edited 2 lines. Then the line endings could become "mixed".)

The alternative solution would be to return an error if the line ending of the selected file does not match the config.

MBuchalik avatar Jan 05 '21 14:01 MBuchalik