Can I redirect unicode output from the console directly into a file?
When printing to the console, Python looks at sys.stdout.encoding to determine the encoding to use to encode unicode objects before printing. When redirecting output to a file, sys.stdout.encoding is None, so Python2 defaults to the ascii encoding. (In contrast, Python3 defaults to utf-8.) This often leads to an exception when printing unicode. You can avoid … Read more