I am reading a csv file using opencsv.
I am ignoring the first line of; the csv file is tab separated with some values enclosed in double quotes.
The problem occurs when I read the values of a column that has the ” character, this is stripped out of the value.
reader = new CSVReader(new FileReader(exchFileObj),'t','"',1);
For example in original file:
address = 1291buenosaires
It becomes as:
address = 1291buenosiares
In the string array that csvreader generates. How do I modify it to be able to read the ” character also?
Advertisement
Answer
CSVReader also has a parser builder via which you can set the escape character to use. If you use that and set the escape character to something you don’t use you will get the backslash character in your input.