0

I am using SuperCSV for reading and writing csv files. The problem i am facing is, under Unix/Linux systems, I am getting "^M" character appending to end of each line, which is quite annoying.

How do I handle/fix that.

beanWriter = new CsvBeanWriter(new FileWriter(this.file), CsvPreference.STANDARD_PREFERENCE);
final CellProcessor[] processors = getProcessors();
beanWriter.write(writeBean, header, processors);

part of code how I am exactly using SuperCSV

RaceBase
  • 18,428
  • 47
  • 141
  • 202

1 Answers1

1

Like the docs and website say, use CsvPreference.EXCEL_PREFERENCE.

James Bassett
  • 9,458
  • 4
  • 35
  • 68
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • I am checking that. Sorry, I missed that somehow before posting this question. But does it solve this problem? – RaceBase Jan 15 '13 at 12:59
  • It should! `CsvPreference.STANDARD_PREFERENCE` includes a window-style carriage return (`\r`) which appears as `^M` on Linux. I just had to remove all of the carriage returns from the Super CSV [source code](https://sourceforge.net/p/supercsv/code/269/) (so I can develop it on Linux), so I feel your pain :) – James Bassett Jan 15 '13 at 20:50