Here you can find the source of encode(String text)
Parameter | Description |
---|---|
text | a parameter |
private static String encode(String text) throws UnsupportedEncodingException
//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"); } }