CSV only with LF, without CR

Jul 4, 2011 at 11:41 AM

I’m reading a CSV file that hasn’t a CR character on break lines and because of that (I think) the ValueDelimiter is not working; he reads the entire file in one line. If the file has CR, the code works properly:

var readerProducts = new CsvReader(filename);

readerProducts.ValueSeparator = ',';

readerProducts.ValueDelimiter = '\n';

readerProducts.ReadHeaderRecord();

(...)

This is a print screen of CSV files with and without CR char:

 

There’s some solution to read this file with only LF char ?

Thank you for your attention!

Best Regards,

David

Coordinator
Jul 6, 2011 at 2:41 PM

Hi David,

The ValueDelimiter is the character used to demarcate values that contain the value separator. For example, if your value separator is a comma and you have a value of Boogaart, Kent then it will be wrapped in the value delimiter to avoid ambiguity:

Name,Height
"Boogaart, Kent",1.83m
In this case, the value delimiter is a double quote.

None of the values in your sample data are wrapped in delimiters. Therefore, you should just leave the ValueDelimiter as is. You do not need to specify whether the line breaks are Windows, Unix, or Mac-style. KBCsv will figure it out.

Best,
Kent

Jul 6, 2011 at 3:44 PM

Hi Kent! :)

Thank you for your help. I miss understand the mean of ValueDelimiter.

I love your CSV reader! Thank you for develop it!

 

Best regards,
David