Here you can find the source of decodeValue(String value)
value
decoded from JavaScript's decodeURIComponent() format.
public static String decodeValue(String value)
//package com.java2s; /******************************************************************************* * Copyright ? 2008, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from www . j a v a2 s .co m*/ * IBM Corporation - initial API and implementation * *******************************************************************************/ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; public class Main { /** * @return <code>value</code> decoded from JavaScript's decodeURIComponent() format. */ public static String decodeValue(String value) { try { return URLDecoder .decode(value, "UTF-8").replaceAll("\\%20", " ").replaceAll("\\!", "\\%21").replaceAll("\\'", "\\%27") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ .replaceAll("\\(", "\\%28").replaceAll("\\)", "\\%29").replaceAll("\\~", "\\%7E"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } catch (UnsupportedEncodingException e) { // Shouldn't happen, but just in case... return value .replaceAll("\\%20", " ").replaceAll("\\!", "\\%21").replaceAll("\\'", "\\%27").replaceAll("\\(", "\\%28") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ .replaceAll("\\)", "\\%29").replaceAll("\\~", "\\%7E"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } } }