Revert patch from #245 and use sys.getdefaultencoding