Don't assume the stream has a setEncoding method.