Tomcat迁移到WebsphereURL获取中文参数乱码问题

URL携带中文参数时,tomcat通常用两种方法可以解决中文乱码问题:

String param  = new String(request.getParameter("param ").getBytes("ISO-8859-1"), "UTF-8");
String param  = java.net.URLDecoder.decode(request.getParameter("param "),"UTF-8");

但是在Websphere中文参数只能使用后者这种解码


String param  = java.net.URLDecoder.decode(request.getParameter("param "),"UTF-8");

前提是js必须对中文参数进行编码:

var href = "/servlet?param="+encodeURI(encodeURI("转码中文"));
window.location.href=href;
原文地址:https://www.cnblogs.com/zhutouying/p/3336953.html