Java URL Decode decodeRfc5849(final String value)

Here you can find the source of decodeRfc5849(final String value)

Description

Percent decodeRfc5849 the value as specified by the RFC5849 (3.6).

License

Apache License

Declaration

static String decodeRfc5849(final String value) 

Method Source Code

//package com.java2s;
/* Utils.java// w w  w  .  j a va2  s.  c o m
 *
 * Created: 2012-10-01 (Year-Month-Day)
 * Character encoding: UTF-8
 *
 ****************************************** LICENSE *******************************************
 *
 * Copyright (c) 2012 - 2013 XIAM Solutions B.V. (http://www.xiam.nl)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.UnsupportedEncodingException;

import java.net.URLDecoder;

public class Main {
    /**
     * The canonical character set name for {@code UTF-8}.
     * {@code UTF-8} is the only character set used by JSON.
     */
    static final String UTF8 = "UTF-8";

    /**
     * Percent decodeRfc5849 the value as specified by the RFC5849 (3.6).
     */
    static String decodeRfc5849(final String value) {
        try {
            return URLDecoder.decode(value, UTF8);
        } catch (UnsupportedEncodingException ex) {
            throw new AssertionError(ex); // UTF-8 is always supported
        }
    }
}

Related

  1. DecodePath(String path)
  2. decodePercent(String s)
  3. decodePercent(String str)
  4. decodeRequestBody(String requestBody)
  5. decodeRequestString2(String inputString)
  6. decodeSpecialMdxCharactersInNames(String name)
  7. decodeStr(String str)
  8. decodeString(String cookedTextString)
  9. decodeString(String myString)