In Python 3, there seem to be two ways to set sys.stdout to utf-8 after the script has started:
sys.stdout = codecs.getwriter('utf-8')(sys.stdout.detach()) sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8') I guess the second is better. At start-up, type(sys.stdout) is <class '_io.TextIOWrapper'>, and it's also after using the second method. After using the first method, type(sys.stdout) is changed to <class 'encodings.utf_8.StreamWriter'>. Should I always use the second method? -- Peter Kleiweg http://pkleiweg.home.xs4all.nl/ -- http://mail.python.org/mailman/listinfo/python-list