首页 > 代码库 > servlet处理乱码之post和get

servlet处理乱码之post和get

  post请求处理乱码

    request.setCharacterEncoding(UTF-1);
            response.setContentType("text/html;charset=utf-8);

get 请求处理乱码,在tomcat中的conf目录下的server.xml中添加URIEncoding="UTF-8"

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

 

servlet处理乱码之post和get