6

我在生产环境(CentOS 5.6)中遇到此错误,但在开发环境(Ubuntu 11.04)中运行良好。在这两种环境中,该应用程序都使用 Ruby 1.9.3 和 Rails 3.0.9,并由乘客和 nginx 提供服务。我的机械化宝石版本是 2.3。

code converter not found (UTF-8)

此代码的最后一行触发它:

mech = Mechanize.new
page = mech.get("http://myurl.com/login.php?login_name=a&password=b")
form = page.form_with(:name => "loginForm")
form.field_with(:name => "active_pgm").value = '1'
page = form.submit

有任何想法吗?我config.encoding = "utf-8"的application.rb中有。

4

2 回答 2

1

This is a longshot yet perhaps it will help you, because I saw similar errors on RHEL for other parsing gems.

The solution I found was not in Rails -- it was adding these lines to the system environment:

LANGUAGE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
于 2012-04-03T12:55:25.573 回答
1

尝试将您的 application.rb 更改为 read config.encoding = "UTF-8"。我不确定为什么这会是一个问题,但值得一试,因为错误抱怨找不到“UTF-8”(大写)。

于 2012-03-27T19:25:16.983 回答