urlrewrite 中文件参数乱码问题

Spring89 2012-12-21 12:00:15
请求地址:/search/冒险.html
在Action里获取时,是乱码“??”


String keyword = null == request.getParameter("keyword") ? "" : request.getParameter("keyword");
keyword = new String(keyword .getBytes("ISO-8859-1"),"utf-8");


这里的keyword打印出来是"??",请问这是什么问题啊,怎么解决啊!
...全文
151 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuxin1128 2013-03-05
  • 打赏
  • 举报
回复
另一篇贴子已回!加上URIEncoding="UTF-8"是没什么用的!
BUG胡汉三 2012-12-21
  • 打赏
  • 举报
回复
在传进来之前转码encodeURI 还不行就看看Web容器的server.xml文件中找到Connector节点、加上编码 URIEncoding="UTF-8"

<Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" URIEncoding="UTF-8"/>
liu4626846 2012-12-21
  • 打赏
  • 举报
回复
请求地址改下 例如location.href = "/search/冒险.html"; 修改成location.href = encodeURI(""/search/冒险.html");
Spring89 2012-12-21
  • 打赏
  • 举报
回复
引用 1 楼 liu4626846 的回复:
请求地址改下 例如location.href = "/search/冒险.html"; 修改成location.href = encodeURI(""/search/冒险.html");
加了,Connector节点也加了URIEncoding="UTF-8",结果还是乱码!和之前是一样的!

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧