Here you can find the source of urlDecode(String scope)
public static String urlDecode(String scope)
//package com.java2s; //License from project: Open Source License public class Main { /** Performs url decoding. */*www . j a v a2 s.c o m*/ * This utility function percent encodes a text so that it can be * embodied verbatim in a URL (e.g. as a fragment). * * @see #urlEncode(String scope) */ public static String urlDecode(String scope) { StringBuffer result = new StringBuffer(); for (int i = 0; i < scope.length(); ++i) { char c = scope.charAt(i); if (c == '+') { result.append(' '); } else if (c == '%' && i + 2 < scope.length()) { int start = i + 1; String h = scope.substring(start, start + 2); try { long hval = Long.parseLong(h, 16); result.append("" + (byte) hval); } catch (NumberFormatException nfe) { result.append(c); } } else { result.append(c); } } return result.toString(); } }