D.Compat.CreatePipe: use locale encoding

Issue #1895. `createPipe` opened handles in binary mode by default,
which mangles text encoded for the current locale. Now, `hSetEncoding`
is called on the new handles. This requires `base >= 4.2`.