0℃
JAVA 中URL链接中文参数乱码的若干处理方法,现在整理收录如下:
http://xxx.do?ptname='我是中国人'
String strPtname = request.getParameter("ptname");
strPtname = new String(strPtname.getBytes("ISO-8859-1"), "UTF-8");
<%@ page contentType="text/html;charset=gb2312" %>
<a href="ds.jsp?url=<%=java.net.URLEncoder.encode("编码的是这里","GB2312")%>">点击这里</a>
<%
//request.setCharacterEncoding("GBK");
if(request.getParameter("url")!=null)
str=req...
java, 编码阅读全文