Here you can find the source of encode(String s)
public static String encode(String s)
//package com.java2s; //License from project: Apache License import java.net.URLEncoder; public class Main { public static String encode(String s) { String ret = s;/*w w w. j av a2s . c o m*/ try { ret = URLEncoder.encode(s.trim(), "UTF-8"); } catch (Exception localException) { } return ret; } }