从asp.net导出csv这样配置可以防止韩文等乱码,在头部加上0xEF, 0xBB, 0xBF:
string fileName = "attachment;filename=" + HttpUtility.UrlEncode("文档");
Response.AppendHeader("Content-Disposition", httpHeader);
Response.ContentType = "text/csv";
Response.Charset = "UTF-8";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.HeaderEncoding = System.Text.Encoding.UTF8;
Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF }); //Important!
Response.Write(sw);
Response.Flush();
Response.Close();
-