question: public static void partialURLEncodeVal ( Appendable dest , String val ) throws IOException { for ( int i = 0 ; i < val . length ( ) ; i ++ ) { char ch = val . charAt ( i ) ; if ( ch < 32 ) { dest . append ( '%' ) ; if ( ch < 0x10 ) dest . append ( '0' ) ; dest . append ( Integer . toHexString ( ch ) ) ; } else { switch ( ch ) { case ' ' : dest . append ( '+' ) ; break ; case '&' : dest . append ( "%26" ) ; break ; case '%' : dest . append ( "%25" ) ; break ; case '=' : dest . append ( "%3D" ) ; break ; case '+' : dest . append ( "%2B" ) ; break ; default : dest . append ( ch ) ; break ; } } } }
target:  URLEncodes a value, replacing only enough chars so that the URL may be unambiguously pasted back into a browser. <p> Characters with a numeric value less than 32 are encoded. &amp;,=,%,+,space are encoded.