It does not forget a seen BOM, therefore, you cannot reuse a UTF-16 -> UTF-8
converter for converting chunks of UTF-16 of different endianness, even if they
both start with a BOM.
The attached testcase demonstrates this.
Created attachment 117544 [details]
This is not a bug. Flushing using iconv() only resets the shift state. This is
needed for stateful encodings with states where the caller wants a converted
string to end in the initial state. The BOM recognition has nothing to do with
shift states. Once the byte order is determined this is a property which stays
with the iconv_t descriptor for its lifetime.