Unix TUI: make sure to only feed the stream acceptable characters

If targetStream.encoding='ascii', we cannot feed it non-ascii
characters. We therefore have to encode using 'replace' (which
will turn all non-ascii characters into ?'s), then decode,
then feed it as unicode (py3 str) into the stream.

Then the stream will decode it again, and show it to the user.

Should fix the archiveBot test failures.

Change-Id: I1655e28b19cfe1aada0d29fd912c214b9b6de5ca
Merge "Unix TUI: make sure to only feed the stream acceptable characters"