【Android开发】URL 转义与反转义
1,转义
@org.junit.Test
public void testEncode(){
String url="http://192.168.0.19:8888/cas/login";
String urlEncodee= URLEncoder.encode(url);
System.out.println(urlEncodee);
}
2,反转义
@Test
public void testDecode(){
String url="http%3A%2F%2F192.168.0.19%3A8888%2Fcas%2Flogin";
String urlDecode= URLDecoder.decode(url);
System.out.println(urlDecode);
}