java 后端 url跳转参数中文编码
作者:互联网
//跳转参数中文编码String StrUrl = "URL地址"; String parmVals[] = StringUtils.split(StrUrl ,"&"); if(parmVals.length>0){ StringBuffer sbf = new StringBuffer(parmVals[0]); for (int i = 1; i < parmVals.length ; i++) { String parmVal[] = StringUtils.split(parmVals[i],"="); if(parmVal.length>1){ sbf.append("&").append(parmVal[0]).append("=").append(URLEncoder.encode(parmVal[1])); } } System.out.println("新的url地址:"+sbf.toString()); }
标签:parmVals,java,String,url,length,parmVal,跳转,sbf,append 来源: https://www.cnblogs.com/huhu-jie/p/14804573.html