fix an error if a stream encoding type is None

With the encoding refactor an error was introduced where if the encoding type of the stream was None a TypeError exception was thrown saying `encode() argument 1 must be string, not None`.

This rare case happens if the stdout stream is being emulated or intercepted in a build system such as Jenkins and unicode characters were being fed through the put() command.  The resulting sys.system.out stream.encoding would be None.

This fix ensures that if the stream encoding is unknown if allows the message to just decode it the best it can.