如何在Java中进行URL解码?
2022-08-31 04:45:13
在Java中,我想转换这个:
https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do%3Frequest_type
对此:
https://mywebsite/docs/english/site/mybook.do&request_type
这是我到目前为止所拥有的:
class StringUTF
{
public static void main(String[] args)
{
try{
String url =
"https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do" +
"%3Frequest_type%3D%26type%3Dprivate";
System.out.println(url+"Hello World!------->" +
new String(url.getBytes("UTF-8"),"ASCII"));
}
catch(Exception E){
}
}
}
但它不能正常工作。这些和格式叫什么,我该如何转换它们?%3A
%2F