日中 韩文 中文 乱码 问题
时间:2011-12-26
来源:互联网
C# code
以上 会乱码 求大牛们 支招 不胜感激!
System.IO.StringWriter sw = new System.IO.StringWriter(); sw.WriteLine(" 파이브커피숍・スター・ダイアモン中文"); sw.Close(); Response.Clear(); Response.Buffer = true; HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Now.ToShortDateString() +".xls"); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HttpContext.Current.Response.Charset = "UTF-8"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default; HttpContext.Current.Response.Write(sw.ToString()); HttpContext.Current.Response.End();
以上 会乱码 求大牛们 支招 不胜感激!
作者: rolloxa 发布时间: 2011-12-26
改为:
HttpContext.Current.Response.Charset = "UTF-8";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
编码要一致。在简体中文操作系统中,Default一般默认为gb2312,所以不一致。。
HttpContext.Current.Response.Charset = "UTF-8";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
编码要一致。在简体中文操作系统中,Default一般默认为gb2312,所以不一致。。
作者: dalmeeme 发布时间: 2011-12-26
C# code
这句我试过 改成这样的话 就彻底 都乱码了
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
这句我试过 改成这样的话 就彻底 都乱码了
引用 1 楼 dalmeeme 的回复:
改为:
HttpContext.Current.Response.Charset = "UTF-8";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
编码要一致。在简体中文操作系统中,Default一般默认为gb2312,所以不一致。。
改为:
HttpContext.Current.Response.Charset = "UTF-8";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
编码要一致。在简体中文操作系统中,Default一般默认为gb2312,所以不一致。。
作者: rolloxa 发布时间: 2011-12-26
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28