Java URL Decode unescape(String s)

Here you can find the source of unescape(String s)

Description

unescape UTF8/URL encoded strings

License

Open Source License

Parameter

Parameter Description
s a parameter

Declaration

public static String unescape(String s) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2003, 2006 Subclipse project 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 ww w.j  a va 2  s  . c o m*/
 *     Subclipse project committers - initial API and implementation
 ******************************************************************************/

import java.net.URLDecoder;

public class Main {
    /**
     * unescape UTF8/URL encoded strings
     * 
     * @param s
     * @return
     */
    public static String unescape(String s) {
        try {
            return URLDecoder.decode(s, "UTF-8");
        } catch (Exception e) {
            return s;
        }
    }
}

Related

  1. pathDecode(String path)
  2. pathDecode(String path)
  3. percentDecode(String encodedString, String messageEncoding)
  4. percentDecode(String str, boolean plusToSpace)
  5. safeDecode(String s)
  6. unescape(String string)
  7. unescape(String theString)
  8. urlDecode(String s)
  9. urlDecode(String scope)