static String encodeURLString ( String stringToEncode ) { try { return java . net . URLEncoder . encode ( stringToEncode , "UTF-8" ) . replace ( "+" , ENCODED_SPACE_CHARACTER ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; // can't happen } }
Encode a string using URL encoding