public static @NotNull CharSequence unescapePercentSequences(@NotNull CharSequence s, int from, int end) {
    int i = indexOf(s, from, end);
    if (i == -1) {
      return s.subSequence(from, end);
    }

    StringBuilder decoded = new StringBuilder();
    decoded.append(s, from, i);

    byte[] byteBuffer = null;
    int byteBufferSize = 0;
    while (i < end) {
      char c = s.charAt(i);
      if (c == '%') {
        if (byteBuffer == null) {
          byteBuffer = new byte[end - from];
        }
        else {
          byteBufferSize = 0;
        }
        while (i + 2 < end && s.charAt(i) == '%') {
          final int d1 = decode(s.charAt(i + 1));
          final int d2 = decode(s.charAt(i + 2));
          if (d1 != -1 && d2 != -1) {
            byteBuffer[byteBufferSize++] = (byte)((d1 & 0xf) << 4 | d2 & 0xf);
            i += 3;
          }
          else {
            break;
          }
        }
        if (byteBufferSize != 0) {
          decoded.append(new String(byteBuffer, 0, byteBufferSize, StandardCharsets.UTF_8));
          continue;
        }
      }

      decoded.append(c);
      i++;
    }
    return decoded;
  }
public static @NotNull CharSequence unescapePercentSequences(@NotNull CharSequence s, int from, int end)