In Java, I want to convert this:
https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do%3Frequest_type
To this:
https://mywebsite/docs/english/site/mybook.do&request_type
This is what I have so far:
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){
}
}
}
But it doesn't work right. What are these %3A
and %2F
formats called and how do I convert them?
url
string are ASCII, and this is also true after the string has been URL decoded.'%'
is an ASCII char and%xx
represents an ASCII char ifxx
is less than (hexadecimal)80
. – Cusec