public static String encodePath(String path){
  return encodePath(path,true);
}

public static String encodePath ( String path ) { return encodePath ( path , true ) ; }
constructs an encoded version of the specified path string suitable for use in the construction of a url . a path separator is replaced by a forward slash . the string is utf8 encoded . the % escape sequence is used for characters that are above 0x7f or those defined in rfc2396 as reserved or excluded in the path component of a url .
