Here you can find the source of encode(final String value, final String charset)
public static String encode(final String value, final String charset)
//package com.java2s; //License from project: BSD License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String encode(final String value) { return encode(value, "UTF-8"); }/*from w w w .ja v a 2s . co m*/ public static String encode(final String value, final String charset) { try { return URLEncoder.encode(value, charset); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } } }