code: public static String urlEncode(String string, String enc) {
  		try {
  			return URLEncoder.encode(string, enc);
  		} catch (UnsupportedEncodingException e) {
  			throw new IllegalArgumentException("Can't encode with supplied encoding: " + enc, e);
  		}
  	}
docs: Translates a string into application/x-www-form-urlencoded format using a specific encoding scheme.
  This method uses the supplied encoding scheme to obtain the bytes for unsafe characters
  
  @param string string for encoding
  @param enc    new encoding
  @return the translated String.