public static String encodePathQuery(final String unescaped,final String charset) throws URIException {
  final int at=unescaped.indexOf('?');
  if (at < 0) {
    return encode(unescaped,URI.allowed_abs_path,charset);
  }
  return encode(unescaped.substring(0,at),URI.allowed_abs_path,charset) + '?' + encode(unescaped.substring(at + 1),URI.allowed_query,charset);
}

public static String encodePathQuery ( final String unescaped , final String charset ) throws URIException { final int at = unescaped . indexOf ( '?' ) ; if ( at < 0 ) { return encode ( unescaped , URI . allowed_abs_path , charset ) ; } return encode ( unescaped . substring ( 0 , at ) , URI . allowed_abs_path , charset ) + '?' + encode ( unescaped . substring ( at + 1 ) , URI . allowed_query , charset ) ; }
escape and encode a string regarded as the path and query components of an uri with a given charset .
