question: 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 ; }
target:  Formats the input string for inclusion in a url.  Account for the differences in how OAuth encodes certain characters (such as the space character).