Skip to content
  • Christos Stavrakakis's avatar
    Fix UnicodeError when writing to sys.stdout · 25c928b6
    Christos Stavrakakis authored
    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.
    25c928b6