public static String pathEncode ( String path , Charset charset ) { return encodeReserved ( path , FragmentType . PATH_SEGMENT , charset ) ; /* * path encoding is not equivalent to query encoding, there are few differences, namely dealing * with spaces, !, ', (, ), and ~ characters. we will need to manually process those values. */ // return encoded.replaceAll("\\+", "%20"); }
Uri Encode a Path Fragment .