Fix encoding issue

Hello,

To reproduce: git hub repos | grep stuff

Python has this wonderful ability to not fail on encoding problem when you only output on the shell, but once you do a "|" or ">" or ">>" it will miserably fail. I haven't checked the other commands.

Kind regards,