Java URL Encode encode(final String value, final String charset)

Here you can find the source of encode(final String value, final String charset)

Description

encode

License

BSD License

Declaration

public static String encode(final String value, final String charset) 

Method Source Code


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

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class Main {
    public static String encode(final String value) {
        return encode(value, "UTF-8");
    }/*from w  w w  .ja v a 2s  .  co m*/

    public static String encode(final String value, final String charset) {
        try {
            return URLEncoder.encode(value, charset);
        } catch (UnsupportedEncodingException e) {
            throw new IllegalStateException(e);
        }
    }
}

Related

  1. encode(final Object id)
  2. encode(final String content, final String encoding)
  3. encode(final String raw)
  4. encode(final String s, final String enc)
  5. encode(final String string)
  6. encode(HashMap map)
  7. encode(Object parameter)
  8. encode(Object value)
  9. encode(Properties prop)