Using Unicode console output with Python

On Windows console and Unicode are not quite friends. Here is some code that I use in order to assure that my Python scripts output is consistent on all platforms and is supporting Unicode encoded as UTF-8. You’ll be able to see the right characters if you are running on Windows 7 but on Windows XP you’ll see the UTF-8 codes displayed as ANSI. Even with this problem you’ll be able to redirect the output of stdout or stderr to files in order to store UTF-8 output.