Use terminal encoding for std{in,out,err}

This fixes issue #11162.

`File` constructor takes a `QTextCodec`, called `codec`; but, if `codec` is `NULL`, then it assumes "binary" mode.  This "binary" mode causes non-ascii characters to be converted to NUL (`\0`) when `File::write` is called.

This change passes to the `File` constructor the codec used by the `Terminal` class, which can be set via a command-line option.