文章目录 一、知识点1.样子2.原因 二、解码Reference
一、知识点 1.样子
https%3A%2F%2Fblog.csdn.net%2Fsandalphon4869%2F
这样有%之类的就是URL编码,意思是https://blog.csdn.net/sandalphon4869/。
URL 只能使用 ASCII 字符集来通过因特网进行发送。 (英文字母、阿拉伯数字和某些标点符号)
所有不能直接使用如中文和特殊符号。
那就得用一种方式来表达其他字符。
比如%7B表示{。
PS:可以去试试什么样:http://www.jsons.cn/urlencode/
二、解码java.net.URLDecoder.decode("XXX","UTF-8");:
返回一个解码后的字符串第一个参数是要解码的URL字符串第二个参数是编码方式。例子:
String URLString = "https%3A%2F%2Fblog.csdn.net%2Fsandalphon4869%2F";String result = null;try { result = java.net.URLDecoder.decode(URLString,"UTF-8");} catch (UnsupportedEncodingException e) { e.printStackTrace();}PS:编码换成函数java.net.URLEncoder.encode()
ReferenceURL编码与解码
Java 编码 和JSON
1.编码