public static String encodePath(String path) {
    try {
      return new URI(null, null, path, null, null).toASCIIString();
    }
    catch (URISyntaxException e) {
      return path;
    }
  }
public static String encodePath(String path)