Example: The Unicode character '→' (U+2192) appears in the output as U+001A.

That does not happen if the stdout argument is assigned to a StringIO instance.

However, the disadvantage is that output assigned to stdout is heavily buffered. If I have a long-running computation which continuously produces output, I have to choose between proper Unicode output and immediate feedback.
I though this might be a property of StringIO, and tried to intercept write calls.

But from the result it is clear that stdout.write is only called once. I also tried to induce flushing by inserting newline characters in the output, with no success.