通用的解决方案
第一种方式:
String userName = request.getParameter("userName") ; byte[] bytes = userName.getBytes("iso8859-1"); userName = new String(bytes , "UTF-8") ; System.out.println(request.getMethod()+userName);
第二种方式:
request.setCharacterEncoding("UTF-8") ; String userName = request.getParameter("userName") ; System.out.println(userName);
POST请求的乱码