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