我做的功能是导出Excel
代码如下
protected void Button1_Click(object sender, EventArgs e)
    {
        string Year = System.DateTime.Now.Year.ToString();
        string Month = System.DateTime.Now.Month.ToString();
        string Day = System.DateTime.Now.Day.ToString();
        string DateString = Year + "-" + Month + "-" + Day;        ExportToExcel("application/ms-excel", DateString + ".xls");
    }
    public void ExportToExcel(string FileType, string FileName)
    {
        Response.Charset = "GB2312";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        //System.Text.Encoding.UTF8;
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8).ToString());
        Response.ContentType = FileType;
        this.EnableViewState = false;
        StringWriter tw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(tw);
        MedicineList.RenderControl(hw);
        Response.Write(tw.ToString());
        Response.End();
    }一般的都不会出错  今天突然运行处一条乱码数据  求解  是因为什么UTF8GB2312乱码