docs: private static String encodeUrlPart(final String part) throws UnsupportedEncodingException {
          //we need to go through and check part by part that a section does not need encoding
  
          int pos = 0;
          for (int i = 0; i < part.length(); ++i) {
              char c = part.charAt(i);
              if(c == '?') {
                  break;
              } else if (c == '/') {
                  if (pos != i) {
                      String original = part.substring(pos, i);
                      String encoded = URLEncoder.encode(original, UTF_8);
                      if (!encoded.equals(original)) {
                          return realEncode(part, pos);
                      }
                  }
                  pos = i + 1;
              } else if (c == ' ') {
                  return realEncode(part, pos);
              }
          }
          return part;
      }