Djangoをmod_fcgidとApacheで動かしていて、
UnicodeEncodeError: 'ascii' codec can't encode characters
のエラーが出る時の対処法。
次の一行を、httpd.confに追加する必要がある。
FcgidInitialEnv LANG "ja_JP.UTF-8"
「ソース」
https://code.djangoproject.com/ticket/17686
"django wouldn't get the locale settings of my user. In fact the fcgi script wouldn't, even if my envvars script was properly configured."
とあるように、なぜかenvvarsなどで設定しても効果がない。。。
LC_ALLなど環境変数に"ja_JP.UTF-8"を設定してもダメだった。。
mod_wsgiでは問題がなかったのに。。。
この情報を見つけるのに、数時間も費やしてしまった。