response流转页面传接中文参数值乱码解决

response流转页面传递中文参数值乱码解决?httpServletResponse.sendRedirect(/Action.do?actionsearch&n

response流转页面传递中文参数值乱码解决

?

httpServletResponse.sendRedirect("/Action.do?action=search&name=方便面");

String name = httpServletRequest.getParameter("name");

?

name为乱码.

?

解决办法为使用java.net.URLEncode进行转换:

?

httpServletResponse.sendRedirect("/Action.do?action=search&name=" + URLEncoder.encode("方便面","gbk");