According to the documentation, iconv(cd) with both inputbuffer and outputbuffer set to NULL should reset the state of `cd`. However, this does not work for "unicode" atleast. A unicode stream starts with a BOM character, and after a iconv(cd, 0, 0, 0, 0), I just get an error if I feed it with a new BOM character. cd=iconv_open("utf-8", "unicode"); iconv(cd, unicode_string_with_bom, &srclen, &target, &targetlen); /* ok */ iconv(cd, 0, 0, 0, 0); /* this should reset the state of cd */ iconv(cd, unicode_string_with_bom, &srclen, &target, &targetlen); /* this now fails*
Fixed in cvs.