Java URL Encode encode(String text)

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

Description

Encode text as UTF-8

License

Open Source License

Parameter

Parameter Description
text a parameter

Declaration

private static String encode(String text) throws UnsupportedEncodingException 

Method Source Code


//package com.java2s;
import java.io.*;

import java.net.URLEncoder;

public class Main {
    /**/* w w w.  j a  va 2 s  .com*/
     * Encode text as UTF-8
     *
     * @param text
     * @return
     */
    private static String encode(String text) throws UnsupportedEncodingException {
        return URLEncoder.encode(text, "UTF-8");
    }
}

Related

  1. encode(String src, String srcCode, String destCode)
  2. encode(String str)
  3. encode(String str)
  4. encode(String string)
  5. encode(String strInput)
  6. encode(String toBeEncoded, String charSet, String defaultReturnValue)
  7. encode(String value)
  8. encode(String value)
  9. encode(String value)