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

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

I am checking that. Sorry, I missed that somehow before posting this question. But does it solve this problem?
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 (so I can develop it on Linux), so I feel your pain :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.