Java URL Decode decode(String raw)

Here you can find the source of decode(String raw)

Description

Decode the message by replacing all the %20 with white spaces.

License

BSD License

Parameter

Parameter Description
raw Raw data from the Web message.

Return

The actual text in regular ASCII form.

Declaration

public static String decode(String raw) 

Method Source Code


//package com.java2s;
//License from project: BSD License 

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

public class Main {
    /**/*ww  w.  j  av  a2 s . c o  m*/
     * <p>Decode the message by replacing all the %20 with white spaces.</p>
     *
     * @param raw Raw data from the Web message.
     *
     * @return The actual text in regular ASCII form.
     */
    public static String decode(String raw) {
        String encoded = null;

        try {
            encoded = URLDecoder.decode(raw.replaceAll("%20", " "), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return encoded;
    }
}

Related

  1. decode(String encodeMsg)
  2. decode(String input)
  3. decode(String input)
  4. decode(String path)
  5. decode(String path, String encoding)
  6. decode(String s)
  7. decode(String s)
  8. decode(String s)
  9. decode(String s)