Christian Weisgerber: > Can you provide an example that triggers the problem? > Or an explanation?
In the "while (cursor > input_buffer || input_char != EOF)" loop, the "cursor" pointer sometimes refers to "input_buffer" and sometimes to "output_buffer". It must refer to "input_buffer" at the start of the loop, but the present code forgets to ensure this. Sometimes this is made obvious to the user (example on OpenBSD 5.5): $ perl -e 'print "\xc3\xa4"x1025' | recode utf8..latin1 | wc -c libiconv.c internal error 56 recode: Internal recoding bug in step `UTF-8..ISO-8859-1' 1024 And sometimes input is silently discarded: $ perl -e 'print "\xc3\xa4"x2000' | recode utf8..latin1 | wc -c 1488 $ # should be 2000 characters