docs: public static String encodePath(String path) {
          // Any characters that are not one of the following are
          // percent-encoded (including spaces):
          // a-z A-Z 0-9 . - _ ~ ! $ &amp; ' ( ) * + , ; = : @ / %
          if (StringUtils.isBlank(path)) {
              return path;
          }
          StringBuilder sb = new StringBuilder();
          for (char ch : path.toCharArray()) {
              // Space to plus sign
              if (ch == ' ') {
                  sb.append("%20");
                  // Valid: keep it as is.
              } else if (CharUtils.isAsciiAlphanumeric(ch)
                      || ".-_~!$&'()*+,;=:@/%".indexOf(ch) != -1)  {
                  sb.append(ch);
                  // Invalid: encode it
              } else {
                  byte[] bytes;
                  bytes = Character.toString(ch).getBytes(StandardCharsets.UTF_8);
                  for (byte b : bytes) {
                      sb.append('%');
                      int upper = (((int) b) >> 4) & 0xf;
                      sb.append(Integer.toHexString(
                              upper).toUpperCase(Locale.US));
                      int lower = ((int) b) & 0xf;
                      sb.append(Integer.toHexString(
                              lower).toUpperCase(Locale.US));
                  }
              }
          }
          return sb.toString();
      }