Response.Charset与Response.ContentEncoding的区别

protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Clear(); //清空无关信息
        Response.Buffer= true; //完成整个响应后再发送
        Response.Charset = "GB2312";//设置输出流的字符集-中文
  Response.AppendHeader("Content-Disposition","attachment;filename=Report.doc");//追加头信息
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");//设置输出流的字符集
        Response.ContentType = "application/ms-word ";//输出流的MIME类型
        Response.Write(TextBox1.Text);
        Response.End();//停止输出

你可能感兴趣的:(encoding)