private static String escapeExcludedChars(String unescaped){
  final StringBuilder escaped=new StringBuilder();
  for (int i=0; i < unescaped.length(); i++) {
    char c=unescaped.charAt(i);
    if (!isUnreserved(c) && !reserved.contains(c)) {
      escaped.append("%" + Integer.toHexString((int)c));
    }
 else {
      escaped.append(c);
    }
  }
  return escaped.toString();
}

private static String escapeExcludedChars ( String unescaped ) { final StringBuilder escaped = new StringBuilder ( ) ; for ( int i = 0 ; i < unescaped . length ( ) ; i ++ ) { char c = unescaped . charAt ( i ) ; if ( ! isUnreserved ( c ) && ! reserved . contains ( c ) ) { escaped . append ( "%" + Integer . toHexString ( ( int ) c ) ) ; } else { escaped . append ( c ) ; } } return escaped . toString ( ) ; }
escapes any character that is not either reserved or in the legal range of unreserved characters , according to rfc 2396 .
