How to prevent the error "code converter not found (UTF-8)"?

I get this error in my working environment (CentOS 5.6), but it works fine in development (Ubuntu 11.04). In both environments, the application uses Ruby 1.9.3 and Rails 3.0.9 and is served with passengers and nginx. My version of the mechanical stone is 2.3.

code converter not found (UTF-8)

The last line of this code launches it:

 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 

Any ideas? I have config.encoding = "utf-8" in my .rb application.

+6
source share
2 answers

Try changing the application.rb application to read config.encoding = "UTF-8" . I'm not sure why this will be a problem, but it's worth it, because the error complains that you will not find "UTF-8" (in uppercase).

+1
source

This is a long snapshot, but maybe it will help you because I saw similar errors in RHEL for other syntax faults.

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

 LANGUAGE=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8 
+1
source

Source: https://habr.com/ru/post/911783/


All Articles