Java URL Encode encode(String value)

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

Description

URL encodes a value using the UTF-8 charset

License

Apache License

Parameter

Parameter Description
value the value to encode

Exception

Parameter Description
UnsupportedEncodingException an exception

Return

the encoded value

Declaration

public static String encode(String value) throws UnsupportedEncodingException 

Method Source Code


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

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

public class Main {
    /**/* ww w.j av  a2  s . c o  m*/
     * URL encodes a value using the UTF-8 charset
     *
     * @param value the value to encode
     * @return the encoded value
     * @throws UnsupportedEncodingException
     */
    public static String encode(String value) throws UnsupportedEncodingException {
        return URLEncoder.encode(value, "UTF-8");
    }
}

Related

  1. encode(String strInput)
  2. encode(String text)
  3. encode(String toBeEncoded, String charSet, String defaultReturnValue)
  4. encode(String value)
  5. encode(String value)
  6. encode(String value)
  7. encode(String value, String charset)
  8. encode(String value, String encoding)
  9. encodeArray(final String[] val)