假如你有一段json串是這樣的:{url:http://www.baidu.com}
你看起來很正常 但是解析的時候會發(fā)現(xiàn)..真**坑爹
原因是因為://需要轉換成編碼也就是這個樣{url:http%3A%2F%2Fwww.baidu.com}
程序對url解碼:
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
String deurl = URLDecoder.decode(url,"UTF-8");
必須加編碼UTF-8或者正文的編碼GB2312