URL编码是浏览器发送数据给服务器时使用的编码。
如通过百度搜索美女:
URL编码规则:
public class SplitString {
public static void main(String[] args) throws Exception{
String original = "URL参数";
//编码后
String encoded = URLEncoder.encode(original,"UTF-8");
System.out.println("编码后:"+encoded);
//解码
String ori = new String(URLDecoder.decode(encoded,"UTF-8"));
System.out.println("解码后:"+ori);
char[] cs = original.toCharArray();
}
}
原文:https://www.cnblogs.com/csj2018/p/10827345.html