[vlc-devel] [PATCH 2/8] stream_ReadLine: reset iconv state on conversion error

Pierre Ynard linkfanel at yahoo.fr
Thu Oct 22 01:48:13 CEST 2020

> It seems suspicious that this ends up there rather than under the
> error label.

The error label is going away with the refactoring anyway. The fix is
added in an appropriate place. Conversion errors aren't treated as fatal
error, partial output is still returned while the stream moves on.

So the real question would rather be this latter one, especially under
semantics where we avoid discarding data on error anymore. We could try
to further improve this by actually recovering from conversion errors
and processing and stitching the rest of the line, or having iconv
silenty ignore errors; or on the other hand, depart from the current
fault-tolerant behavior and refuse to return any output at that point,
until the caller deals with the problematic conversion for us (which
seems impractical to me).

Of course this is all rather academic as UTF-16 to UTF-8 isn't exactly
prone to misencoding or conversion issues, and big-endian UTF-16 support
was even broken for a long time without anybody reporting it.

Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."

More information about the vlc-devel mailing list