3

Problem with german umlauts in generated CSV file using Grails

Hi,

I have a problem with the german umlauts like ä,ö,ü in generated CSV files using Grails, here is the snippet of my code

def report = {
    //....
    response.setContentType("text/csv; charset=UTF-8");
    response.setHeader("Content-disposition", "attachment; filename=" + params.dateiname + "");   
    response.setCharacterEncoding("UTF-8")   
    response.outputStream << datalist  // in datalist are the data in CSV format like "File";"Date";"Customer" etc.
}

After calling the closure and saving the file the german umlauts are diplayed wrong with Excel, but they are displayed correct when I open the file with notepad.

Does anyone have an idea of this Problem?

Thanks in advance!

mozilla20

Rob Hruska
  • 118,520
  • 32
  • 167
  • 192
user587816
  • 33
  • 1
  • 3

1 Answers1

4

IIRC, Excel assumes ANSI CSV encoding. Explicit BOM helps sometimes: Microsoft Excel mangles Diacritics in .csv files?

Community
  • 1
  • 1
Victor Sergienko
  • 13,115
  • 3
  • 57
  • 91