public static String encodeURIComponent(String component) {
String result = null;
try {
result = URLEncoder.encode(component, "UTF-8")
.replaceAll("\\%28", "(")
.replaceAll("\\%29", ")")
.replaceAll("\\+", "%20")
.replaceAll("\\%27", "'")
.replaceAll("\\%21", "!")
.replaceAll("\\%7E", "~");
catch (UnsupportedEncodingException e) {
result = component;
}
return result;
}
JAVA URLEncoder和 javascript encodeURLComponent 区别
最新推荐文章于 2021-02-28 06:49:34 发布