Skip to content

Instantly share code, notes, and snippets.

@kimtree
Created April 16, 2019 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimtree/ef82b959b0e1a422ef646971de8ee8a9 to your computer and use it in GitHub Desktop.
Save kimtree/ef82b959b0e1a422ef646971de8ee8a9 to your computer and use it in GitHub Desktop.
import java.net.URL;
import java.net.URLDecoder;
public class HelloWorld
{
public static void main(String[] args)
{
try {
URL url = new URL("http://foo.com?a=[%abc%]&b=test");
System.out.println(url.getPath()+"?"+url.getQuery());
} catch (Exception e) {
e.printStackTrace();
}
String url = "http://foo.com?a=[%abc%]&b=test";
try {
String deStr = URLDecoder.decode(url, "UTF-8");
System.out.println(deStr);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment