首页 > 其他 > 详细

字符串乱码处理

时间:2015-04-21 00:29:26      阅读:194      评论:0      收藏:0      [点我收藏+]
//处理Request
request.setCharacterEncoding("utf-8");
String name = request.getParameter("username");
String newName =new String(name.getBytes("iso-8859-1"),"utf-8");
System.out.println("您输入的是:"+newName);

//处理Rsponse
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");


字符串乱码处理

原文:http://my.oschina.net/u/1861097/blog/404266

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