public String urlEncode(String toEncode){
  try {
    return URLEncoder.encode(toEncode,"utf-8");
  }
 catch (  Exception e) {
    LOG.error("Error url encoding " + toEncode + ": "+ e);
  }
  return toEncode;
}

public String urlEncode ( String toEncode ) { try { return URLEncoder . encode ( toEncode , "utf-8" ) ; } catch ( Exception e ) { LOG . error ( "Error url encoding " + toEncode + ": " + e ) ; } return toEncode ; }
encodes a string using a url encoder
