Make a streaming iconv decoder
(This is just a braindump and need not be acted upon for now.)
For a future feature, it will be necessary to know the position in the raw input received from the PTY that has just been consumed by the parser loop.
The new UTF-8 decoder already works that way, consuming the raw input one byte at a time and pushing a unicode character to the parser once it's been fully received.
However, the legacy encoding support via iconv currently takes the whole of the input and converts it to UTF-8 in one go, and then that is fed to the normal decoder/parser. This makes it impossible to know the the position in the raw input from the position in the UTF-8 stream.
A 'streaming' iconv decoder would instead drive IConv the way the UTF-8 decoder works, taking the raw input one byte at a time and outputting an unicode character when it's been fully decoded. I tried coding this when changing over to the new UTF-8 decoder, but it turned out to be harder than expected so I went with the above-described simpler approach to keep supporting legacy encodings.
(If such a decoder cannot be created, then that feature will simply not be supported in legacy encoding mode.)