code: public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException {
  		return HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY);
  	}
docs: Encodes the given URI query with the given encoding.
  @param query the query to be encoded
  @param encoding the character encoding to encode to
  @return the encoded query
  @throws UnsupportedEncodingException when the given encoding parameter is not supported