string filename = "昨日信息" + DateTime.Now.AddDays(-1).ToShortDateString()+".doc";
            Response.Charset = "GB2312";
            Response.ContentEncoding = System.Text.Encoder("GB2312");
            Response.AddHeader("Content-Disposition", "attachment;filename="+HttpUtility.UrlEncode(filename,System.Text.Encoding.Default));怎么输出的是乱码啊?? 请教一下如何修改为中文

解决方案 »

  1.   

    string filename = "昨日信息" + DateTime.Now.AddDays(-1).ToShortDateString()+".doc";
    你这个文件原来是什么编码的就设置成什么编码,一般是默认UTF8的
    Response.Charset = "UTF8";
      Response.ContentEncoding = System.Text.Encoder("UTF8");具体的看文件
      

  2.   

    应该是用HttpUtility.UrlEncode才对。。
      

  3.   

    Response.ContentEncoding = System.Text.Encoding.UTF7;
      Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());