« Previous | Next » 

Revision a45fc1ae

IDa45fc1ae850b73276efc2b77a254e4a01d60f400

Added by Christos Stavrakakis over 11 years ago

Fix UnicodeError when writing to sys.stdout

Due to a bug the was fixed in Python-2.7, in Python-2.6 unicode strings
that are written to sys.stdout (using sys.stdout.write) are not
converted to bytestrings using the file.encoding. Instead
sys.stdout.encoding is set to None, and the default encoding is used. We
solve this by creating a wrapper to stdout, and encoding everything
either with the file encoding, or with the `locale` prefered encoding.

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences