Fixes pipe() function to retain proper string encoding.
The byte array approach generates garbage bytes at the
end of a source document.

This 'fix' means we are doing plain, repeated string
concatenations, which is likely to be considerably slower
and wasteful. We should fix this at some point.

Signed-off-by: Jim Teeuwen <jimteeuwen@gmail.com>