docs: public static String clean(final String path, final boolean ascii) {
          int len = path.length(), ch;
          final StringBuilder buffer = new StringBuilder(len*3);
          // Change C:/something to /C:/something
          if (len >= 2 && path.charAt(1) == ':') {
              ch = Character.toUpperCase(path.charAt(0));
              if (ch >= 'A' && ch <= 'Z') {
                  buffer.append('/');
              }
          }
  
          // For each character in the path
          int i = 0;
          for (; i < len; i++) {
              ch = path.charAt(i);
              if (ch == '%' && !isPercentEncoded(path.subSequence(i, ((i + 2) < len) ? (i + 3) : len))) {
                  buffer.append('%').append('2').append('5');
                  continue;
              }
              // If it's not an ASCII character, break here, and use UTF-8 encoding
              if (ch >= 128 && ascii) {
                  break;
              }
              if (ch <  gNeedEscaping.length && gNeedEscaping[ch]) {
                  buffer.append('%');
                  buffer.append(gAfterEscaping1[ch]);
                  buffer.append(gAfterEscaping2[ch]);
                  // Record the fact that it's escaped
              } else {
                  buffer.append((char)ch);
              }
          }
  
          // We saw some non-ASCII character
          if (i < len && ascii) {
              // Get UTF-8 bytes for the remaining sub-string
              byte[] bytes;
              byte b;
              bytes = path.substring(i).getBytes(StandardCharsets.UTF_8);
              len = bytes.length;
  
              // For each byte
              for (i = 0; i < len; i++) {
                  b = bytes[i];
                  // For non-ASCII character: make it positive, then escape
                  if (b < 0) {
                      ch = b + 256;
                      buffer.append('%');
                      buffer.append(gHexChs[ch >> 4]);
                      buffer.append(gHexChs[ch & 0xf]);
                  } else if (gNeedEscaping[b]) {
                      buffer.append('%');
                      buffer.append(gAfterEscaping1[b]);
                      buffer.append(gAfterEscaping2[b]);
                  } else {
                      buffer.append((char)b);
                  }
              }
          }
          return buffer.toString();
      }