Decode an encoded URL in Java
Description
The following code shows how to decode an encoded URL.
Example
import java.net.URLDecoder;
// ww w .j a v a2 s.c o m
public class Main {
public static void main(String[] args) throws Exception {
String url = "http://www.%20java2s.com/";
String decoded = URLDecoder.decode(url, "UTF-8");
System.out.println(decoded);
}
}
The code above generates the following result.