Here you can find the source of decode(String encoded)
public static String decode(String encoded) throws UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.net.URLDecoder; public class Main { public static String decode(String encoded) throws UnsupportedEncodingException { String temp = URLDecoder.decode(encoded.toString(), "UTF-8"); if (temp.length() == encoded.length()) { // Decoding was not necessary since it didn't get smaller to return the original. return encoded; } else {/*w w w .ja v a 2 s . co m*/ return temp; } } public static String decode(String encoded, String encoding) throws UnsupportedEncodingException { String temp = URLDecoder.decode(encoded.toString(), encoding); if (temp.length() == encoded.length()) { // Decoding was not necessary since it didn't get smaller to return the original. return encoded; } else { return temp; } } }