Write code to do url decode
Decode using UTF-8
Use URLDecoder.decode() method
//package com.book2s; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; public class Main { public static void main(String[] argv) { String str = "http://book2s.com#$%^&*()"; System.out.println(urldecode(str)); }//w ww . java 2 s .co m public static String urldecode(String str) { try { return URLDecoder.decode(str, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(e); } } }