Here you can find the source of encode(String input)
public static String encode(String input)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.net.*; public class Main { private static String systemEncoding = System.getProperty("file.encoding"); public static String encode(String input) { try {/*from w ww. j a v a 2 s . co m*/ return URLEncoder.encode(input, systemEncoding).replace("+", "%20"); // FIX! usually we want UTF-8, which is not necessarily the system encoding. } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }