0

I have a csv file that is alt code delimited. "Alt 26" or → sign.

this.delimiter = '→';
CsvReader reader = new CsvReader(inputStreamReader, this.delimiter);
for (int i = 0; i < reader.getHeaderCount(); i++) {
    //header fields is no being seperated as per delimiter specified.
}

Code above won't work as the header/fields are not being seperated. Any idea how to replace them?

Arnold Cristobal
  • 843
  • 2
  • 16
  • 36
  • 5
    Are you *sure* that your CSV file actually contains → characters to separate the fields, or are you using a text editor that uses → to display tab characters? – Jesper Aug 01 '17 at 09:08
  • When I open in notepad it shows tab but opening it in excel it shows the arrow sign (alt 26). Using it in excel (alt26) will separate the fields correctly – Arnold Cristobal Aug 01 '17 at 09:17
  • 1
    That means that the file really contains tab characters, not arrows. Excel just translates tabs to arrow characters. – Jesper Aug 01 '17 at 09:39

1 Answers1

0

Try to open file with UTF-8 encoding:

inputStreamReader = new InputStreamReader(new FileInputStream("d:\\a.csv"), "UTF-8"),

like in this question: Parse CSV file containing a Unicode character using OpenCSV

Martinus_
  • 160
  • 1
  • 3
  • 13