package junit.test;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import org.junit.Test;
public class Test_urlDecode {
@Test
public void Test() {
try {
String url = URLEncoder
.encode(
" Modeline \"800x600\" 38.22 800 832 912 1024 600 601 604 622 -HSync +Vsync",
"UTF-8");
System.err.println(url);
System.err.println(URLDecoder.decode(url, "UTF-8"));
String str1="%20Modeline%20%22800x600%22%20%2038.22%20%20800%20832%20912%201024%20%20600%20601%20604%20622%20%20-HSync%20%2BVsync";
System.err.println(URLDecoder.decode(str1,"UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
URLDecoder和URLEncoder
最新推荐文章于 2024-11-12 09:19:56 发布