首页 > Web开发 > 详细

web乱码问题

时间:2015-12-02 22:11:15      阅读:348      评论:0      收藏:0      [点我收藏+]
String data = "不见青山";
ServletOutputStream sos = response.getOutputStream();
byte b[] = data.getBytes();  //默认用平台的gbk编码
sos.write(b)
------------------------------------------------------------------------
(1) response.setHeader("Content-Type", "text/html;charset=UTF-8");
(2) response.setContentType("text/html;charset=UTF-8");
String data = "不见青山";
ServletOutputStream sos = response.getOutputStream();
byte b[] = data.getBytes("UTF-8");  //默认用平台的gbk编码
sos.write(b)


字符
(1) response.setCharacterEncoding("UTF-8");
(2) response.setContentType("text/html;charset=UTF-8");
String data = "春天里";
PrintWriter pw = rsponse.getWriter();
pw.write(data)//默认用ISO-8859-1

以上为response响应乱码解决问题



提交乱码

技术分享

web乱码问题

原文:http://www.cnblogs.com/tuifeideyouran/p/5014150.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!