@SuppressWarnings("deprecation") public static String urlEncode(String s){
  try {
    return URLEncoder.encode(s,"UTF-8");
  }
 catch (  UnsupportedEncodingException e) {
    return URLEncoder.encode(s);
  }
}

@ SuppressWarnings ( "deprecation" ) public static String urlEncode ( String s ) { try { return URLEncoder . encode ( s , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { return URLEncoder . encode ( s ) ; } }
return a url encoded string , assuming " utf - 8 " encoding for input . if utf - 8 is not supported , used default platform encoding .
