If I'm not mistaken, `out` is a bytestring and its `decode` method will decode it from `sys.getdefaultencoding()` (which is usually ascii). `sys.stdout.encoding` looks like a better guess.