code: public static String encode(String value, Charset charset) {
  		try {
  			return URLEncoder.encode(value, charset.name());
  		}
  		catch (UnsupportedEncodingException ex) {
  			throw new IllegalArgumentException("Characterset is not supported.");
  		}
  	}
docs: Uses URLEncoder to translate a string into application/x-www-form-urlencoded format, using the given Charset.