Red Hat Bugzilla – Bug 165368
iconv doesn't completely clean up converter state when converting from UTF-16
Last modified: 2007-11-30 17:11:11 EST
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.