`sys.stdout.encoding` might be None according to docs. In this case, it will use the default encoding.