0

I have a csv file that looks like this:

"first", "abc", "def", "last"
"111", "abc", "p"roblem", "last"
"aaa", "abc", "456", "last"

As you can see the second row has an extra double quote in text.

I am using below constructor:

reader = new CSVReader(new FileReader("temp.csv"), ',', '"', '|', 1);

Program fails because of that extra " in 2nd row.

How can I workaround this problem. I can't change the csv.

Thanks.

Baby
  • 5,062
  • 3
  • 30
  • 52

1 Answers1

0

Your CSV file contains double quotes should be escaped. I've changed the 2nd line to

"111", "abc", "pr\"oblem", "last"

it is working. You can try this. and http://www.csvreader.com/csv_format.php this may help a little more.

Pasupathi Rajamanickam
  • 1,982
  • 1
  • 24
  • 48
  • As I have already mentioned I can not change csv file. I am looking for a solution without touching csv file. – Ravi Gupta Mar 13 '15 at 21:06