JSP中文乱码

1. String rawQueryString=request.getQueryString();

URLDecoder.decode(rawQueryString.split("=")[1], "utf-8");

2.

String parameter=request.getParameter("parameter");

new String(parameter.getBytes("utf-8"));

new String(parameter.getBytes("ISO-8859-1"), "utf-8")

3.

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"
 URIEncoding="UTF-8"/>

4.

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"
useBodyEncodingForURI="true" />

request.setCharacterEncoding("utf-8");
String parameter=request.getParameter("parameter");
out.println(parameter);

posted @ 2017-09-10 10:59  我i编程  阅读(95)  评论(0编辑  收藏  举报