我是英文系统,代码如下,即使我把编码方式改成GB2312也还是乱码,怎么解决
                  response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", strFile));
                response.Charset = "utf-8";
                response.ContentType = "application/ms-excel";
                response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                response.Write(sw);
                response.Flush();
                response.End();

解决方案 »

  1.   

    改了编码还是不行的话,查查Write出去的HTML是否存在垃圾代码
      

  2.   

    StringWriter 的编码方式是UTF-16,但是它的encoding属性是只读的
      

  3.   

    如果是write html的,在前面加上 <meta http-equiv="content-type" content="application/ms-excel; charset=UTF-8"/>
    做个定义,会解决乱码
      

  4.   

    要是wirte html出来,前面加上 <meta http-equiv="content-type" content="application/ms-excel; charset=UTF-8"/>
    做个定义,能解决乱码。