Fix stream encoding none

Took https://github.com/fabric/fabric/pull/1180 and fixed the merge conflicts.

I tried to submit this PR to @joekiller's joekiller:fix-stream-encoding-none, but I can't find his repo in the "base fork" dropdown for some reason so I sent it to fabric/fabric master instead.