When decoding ASCII data containing invalid bytes (>= 0x80) using replacement_handler, the transcoding loop enters an infinite loop because the input iterator is not advanced before calling the error handler.
Repro:
#include <string>
#include <span>
#include <iostream>
#include <ztd/text.hpp>
int main() {
// Invalid ASCII byte (0x80 is >= 0x80, not valid ASCII)
std::string input = "\x80";
std::span<const char> input_span(input.data(), input.size());
// This will hang forever
auto result = ztd::text::transcode(input_span, ztd::text::ascii, ztd::text::compat_utf8,
ztd::text::replacement_handler);
std::cout << "Result: " << result << std::endl;
return 0;
}
My fix 5412d5e