Excel does not display umlaut characters in CSV file created with Super CSV

2.8k views Asked by At

I am using Super CSV for creating CSV file. When I write special characters like umlaut characters ï or î then it breaks in the generated CSV when I open it using Excel. When I open the same file using Notepad++ it shows the umlaut characters perfectly.

Any idea what could be the cause? I have specified UTF-8 encoding. Is there something that I am missing?

ICsvListWriter writer = new CsvListWriter(
    getWriter(getCUSTOMEREXPORT_FOLDERPATH()+filename),
    CsvPreference.STANDARD_PREFERENCE);

private static OutputStreamWriter getWriter(String fileName) {
  final File file = new File(fileName);
  return new OutputStreamWriter(new FileOutputStream(file),
      Charset.forName("UTF-8"));
}
1

There are 1 answers

0
Michael-O On

Microsoft and its Excel are too stupid for UTF-8. Excel strictly requires a byte order mark to realize that this is UTF-8 actually. Add it and it will work.