Don't assume the stream has a setEncoding method. fixes #53