URL转义特定字符
import java.net.URLDecoder; import java.net.URLEncoder; import java.nio.charset.Charset; // 实例代码 String encode = URLEncoder.encode("abcd+ggd pp", "UTF-8"); System.out.println("encode:" + encode); String decode = URLDecoder.decode(encode, "UTF-8"); System.out.println("decode:" + decode);
解决url中将URL特定字符进行转义
前端解决URL特定字符转义的处理方式,参阅encodeURIComponent:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
source URL:https://baike.baidu.com/item/%E8%BD%AC%E4%B9%89%E5%AD%97%E7%AC%A6/86397?fr=aladdin
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.Charset;
URL转义特定字符
[db:回答]