1
1

More than 5 years have passed since last update.

mod_fcgid で UnicodeEncodeError を解決出来ない時の対処法

Last updated at Posted at 2014-01-23

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では問題がなかったのに。。。
この情報を見つけるのに、数時間も費やしてしまった。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1