response乱码
一般都是下面两句话解决问题:
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
==================================================================
request乱码
当请求方式为post时,可以使用下面的话进行设置:
request.setCharacterEncoding("UTF-8"); // 这句话仅对post请求有效
当请求方式为get时,则需要对字符串进行重新编码:
String no = request.getParameter("no");
String newNo = new String(name.getBytes("ISO-8859-1"), "UTF-8"); // 将iso-8859-1编码转换为utf-8