fix when sys.stdout has no encoding attribute (it happen in gunicorn)
1.5.3 version