When writing a Python 3.1 CGI script, I run into horrible UnicodeDecodeErrors. However, when running the script on the command line, everything works.
Short answer: as detailed in mod_cgi + utf8 + Python3 produces no output, just add this in .htaccess:
SetEnv PYTHONIOENCODING utf8
along with:
Options +ExecCGI AddHandler cgi-script .py