- ucnv_toUnicode(converter, &us, uLimit, &s, sLimit, 0, FALSE, &errorCode);
+ errorCode = U_ZERO_ERROR;
+ /*
+ Since we aren't guaranteed to see the state before this call,
+ this code won't work on stateful encodings like ISO-2022 or an EBCDIC stateful encoding.
+ We flush on the last byte to ensure that we output truncated multibyte characters.
+ */
+ ucnv_toUnicode(converter, &us, uLimit, &s, sLimit, 0, !continueReading, &errorCode);