Added encoding to the stream writer