request.setCharacterEncoding()
response.setContentType()
都设过了,中文还是乱码?
试试这个吧。
String username = new String(request.getParameter("username").getBytes("iso-8859-1"), "utf-8");
据说:中文字符在传输中会自动转换为ISO-8859-1格式。用以上写法就能把它转回来了。
JAVA中的中文乱码问题
猜你喜欢
转载自leozam.iteye.com/blog/2238116
今日推荐
周排行