请求地址:/search/冒险.html
在Action里获取时,是乱码“??”
String keyword = null == request.getParameter("keyword") ? "" : request.getParameter("keyword");
 keyword = new String(keyword .getBytes("ISO-8859-1"),"utf-8");
这里的keyword打印出来是"??",请问这是什么问题啊,怎么解决啊!

解决方案 »

  1.   

    请求地址改下例如location.href = "/search/冒险.html";
    修改成location.href = encodeURI(""/search/冒险.html"); 
      

  2.   

    在传进来之前转码encodeURI
    还不行就看看Web容器的server.xml文件中找到Connector节点、加上编码 URIEncoding="UTF-8"<Connector port="8080" protocol="HTTP/1.1" 
                   connectionTimeout="20000" 
                   redirectPort="8443" URIEncoding="UTF-8"/>
      

  3.   


    加了,Connector节点也加了URIEncoding="UTF-8",结果还是乱码!和之前是一样的!
      

  4.   

    另一篇贴子已回!加上URIEncoding="UTF-8"是没什么用的!