java 透過header匯出csv檔亂碼
try{
context.response().putHeader("Content-type", "text/csv; charset=UTF-8")
.putHeader("Content-Disposition", "attachment;filename="+csv_name+".csv;charset=utf-8")
.putHeader("write","\ufeff")
.end(string);
}catch (Exception e){
e.printStackTrace();
}
utf8的csv檔案需要帶bom頭
參考連結 http://blog.csdn.net/youzhoul...
UTF-8改成GBK應該就沒亂碼了,CSV這個是比較坑