streams: set default encoding for writable streams

This commit adds the ability to set the default encoding for writable streams.

Fixes #7159
Few things. We're being better about naming the functions. Make sure the encoding is a string. Also, no need for the braces in a single line `if`.