url = URLEncoder.encode(urlStr,"utf-8").replaceAll("\\+", "%20");
//encode会将空格替换为+号,所有要讲+号替换为空格的转义%20
url = url.replaceAll("%3A", ":").replaceAll("%2F", "/");
//encode会把url里的/和:这2个符号变成%2F和%3A 这里替换回来
2021-07-10 11:26:37
url = URLEncoder.encode(urlStr,"utf-8").replaceAll("\\+", "%20");
//encode会将空格替换为+号,所有要讲+号替换为空格的转义%20
url = url.replaceAll("%3A", ":").replaceAll("%2F", "/");
//encode会把url里的/和:这2个符号变成%2F和%3A 这里替换回来