private static String encode(String stringToEncode){
  String encoded;
  try {
    encoded=URLEncoder.encode(stringToEncode,UTF_8);
  }
 catch (  UnsupportedEncodingException e) {
    throw new MCApiRuntimeException(e);
  }
  encoded=encoded.replace("*","%2A");
  encoded=encoded.replace("~","%7E");
  encoded=encoded.replace("+","%20");
  return encoded;
}

private static String encode ( String stringToEncode ) { String encoded ; try { encoded = URLEncoder . encode ( stringToEncode , UTF_8 ) ; } catch ( UnsupportedEncodingException e ) { throw new MCApiRuntimeException ( e ) ; } encoded = encoded . replace ( "*" , "%2A" ) ; encoded = encoded . replace ( "~" , "%7E" ) ; encoded = encoded . replace ( "+" , "%20" ) ; return encoded ; }
formats the input string for inclusion in a url . account for the differences in how oauth encodes certain characters ( such as the space character ) .
