Don't assume the stream has a setEncoding method.
added spec to cover #54
my own silly style