开发者

Problem with german umlauts in generated CSV file using Grails

开发者 https://www.devze.com 2023-02-06 23:35 出处:网络
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

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

精彩评论

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