question: protected static String encode ( String url ) { StringBuilder encoder = new StringBuilder ( ) ; for ( char chr : url . toCharArray ( ) ) { byte chrByte = ( byte ) chr ; if ( ( chrByte <= 32 || chrByte >= 127 || chr == '#' || chr == '%' ) ) { encoder . append ( String . format ( "%%%02X" , chrByte ) ) ; } else { encoder . append ( chr ) ; } } return encoder . toString ( ) ; }
target:  Replaces all special characters in the url with hex strings.