question: public static String encodeNonCodes ( String string ) { Matcher matcher = nonCodes . matcher ( string ) ; StringBuffer buf = new StringBuffer ( ) ; int idx = 0 ; while ( matcher . find ( idx ) ) { int start = matcher . start ( ) ; buf . append ( string . substring ( idx , start ) ) ; buf . append ( "%25" ) ; idx = start + 1 ; } buf . append ( string . substring ( idx ) ) ; return buf . toString ( ) ; }
target:  Encode '%' if it is not an encoding sequence