开发者

Problem with german umlauts in generated CSV file using Grails

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜