Java URL Decode decodePercent(String str)

Here you can find the source of decodePercent(String str)

Description

Decode percent encoded String values.

License

Open Source License

Parameter

Parameter Description
str the percent encoded <code>String</code>

Return

expanded form of the input, for example "foo%20bar" becomes "foo bar"

Declaration

public static String decodePercent(String str) 

Method Source Code

//package com.java2s;

import java.io.UnsupportedEncodingException;

import java.net.URLDecoder;

public class Main {
    /**/*from   ww  w  .  j av  a 2 s  .c  o  m*/
     * Decode percent encoded <code>String</code> values.
     * 
     * @param str
     *            the percent encoded <code>String</code>
     * @return expanded form of the input, for example "foo%20bar" becomes
     *         "foo bar"
     */
    public static String decodePercent(String str) {
        String decoded = null;
        try {
            decoded = URLDecoder.decode(str, "UTF8");
        } catch (UnsupportedEncodingException ignored) {
        }
        return decoded;
    }
}

Related

  1. decodeKVMap(String keyValueString)
  2. decodeName(final String name)
  3. decodeName(String createdName)
  4. DecodePath(String path)
  5. decodePercent(String s)
  6. decodeRequestBody(String requestBody)
  7. decodeRequestString2(String inputString)
  8. decodeRfc5849(final String value)
  9. decodeSpecialMdxCharactersInNames(String name)