ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) in several Views

Added by Norbert Melzer at 2012-07-25 11:35 am

I have managed to install passenger and chiliproject yesterday.

But there are some problems, very often when I am doing something then I get the 500.html served. The logs tell me the following (example with gantt-chart):

Processing GanttsController#show (for 84.130.17.99 at 2012-07-25 11:19:08) [GET]
  Parameters: {"controller"=>"gantts", "action"=>"show", "project_id"=>"bloggor"}
Rendering template within layouts/base
Rendering gantts/show

ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) on line #124 of app/views/queries/_filters.rhtml:
121:     <tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>" class="filter">
122:     <td style="width:200px;">
123:         <%= check_box_tag 'f[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %>
124:         <label for="cb_<%= field.dup.force_encoding(Encoding::UTF_8) %>"><%= filter[1][:name] || l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym).dup.force_encoding(Encoding::UTF_8) %></label>
125:     </td>
126:     <td style="width:150px;">
127:         <%= label_tag "operators_#{field}", l(:description_filter), :class => "hidden-for-sighted" %>

    app/views/queries/_filters.rhtml:124:in `concat'
    app/views/queries/_filters.rhtml:124:in `block in _run_rhtml_app47views47queries47_filters46rhtml_locals_filters_object_query'
    app/views/queries/_filters.rhtml:118:in `each'
    app/views/queries/_filters.rhtml:118:in `_run_rhtml_app47views47queries47_filters46rhtml_locals_filters_object_query'
    app/views/gantts/show.html.erb:9:in `block in _run_erb_app47views47gantts47show46html46erb'
    app/views/gantts/show.html.erb:4
    app/controllers/gantts_controller.rb:35:in `block (2 levels) in show'
    app/controllers/gantts_controller.rb:34:in `show'
    <internal:prelude>:10:in `synchronize'
    passenger (3.0.14) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
    passenger (3.0.14) lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
    passenger (3.0.14) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
    passenger (3.0.14) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
    passenger (3.0.14) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `block in handle_spawn_application'
    passenger (3.0.14) lib/phusion_passenger/utils.rb:470:in `safe_fork'
    passenger (3.0.14) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:180:in `start'
    passenger (3.0.14) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:219:in `block (2 levels) in spawn_rails_application'
    passenger (3.0.14) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:214:in `block in spawn_rails_application'
    passenger (3.0.14) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
    <internal:prelude>:10:in `synchronize'
    passenger (3.0.14) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
    passenger (3.0.14) helper-scripts/passenger-spawn-server:99:in `<main>'

Rendering /home/nobbz_de/sites/nobbz.de/subdoms/devel/httpdocs/public/500.html (500 Internal Server Error)

I encounter this problem with many subsites, even with creating a project.

I found a workaround by adding .dup.force_encoding(Encoding::UTF_8), and I also tried it in the gantts (as you see in the trace), but I think it cant be that I have to change nearly every template.

I encountered this problem so far with creating a project (semi-fixed), gantt, calender, tickets in general. Perhaps there are more which don't work.

Is there a way to easily fix it? Or should I file this as a bug?

Env:
  • Ubuntu 10.04 LTS Server
  • ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
  • rvm 1.14.7 (master) by Wayne E. Seguin <>, Michal Papis <> [https://rvm.io/]
  • Gems:
    • actionmailer (2.3.14)
    • actionpack (2.3.14)
    • activerecord (2.3.14)
    • activeresource (2.3.14)
    • activesupport (2.3.14)
    • acts-as-taggable-on (2.1.0)
    • addressable (2.3.1)
    • bundler (1.1.5)
    • capybara (1.1.2)
    • childprocess (0.3.4)
    • coderay (1.0.7)
    • daemon_controller (1.0.0)
    • edavis10-object_daddy (0.4.3)
    • fastthread (1.0.7)
    • ffi (1.1.0)
    • gravatarify (3.0.0)
    • i18n (0.4.2)
    • json (1.7.3)
    • libwebsocket (0.1.4)
    • liquid (2.3.0)
    • metaclass (0.0.1)
    • mime-types (1.19)
    • mocha (0.12.1)
    • multi_json (1.3.6)
    • mysql (2.8.1)
    • mysql2 (0.2.18)
    • net-ldap (0.3.1)
    • nokogiri (1.5.5)
    • passenger (3.0.14)
    • pg (0.14.0)
    • rack (1.4.1, 1.1.3)
    • rack-test (0.6.1)
    • rails (2.3.14)
    • rake (0.9.2.2)
    • rdoc (3.12)
    • rmagick (2.13.1)
    • ruby-openid (2.1.8)
    • rubygems-bundler (1.0.3)
    • rubytree (0.5.3)
    • rubyzip (0.9.9)
    • rvm (1.11.3.5)
    • selenium-webdriver (2.25.0)
    • shoulda (2.10.3)
    • sqlite3 (1.3.6)
    • test-unit (2.5.1)
    • tzinfo (0.3.33)
    • xpath (0.1.4)
  • apache 2.2.14-5ubuntu8

Replies (7)

RE: ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) in several Views - Added by Norbert Melzer at 2012-07-25 03:25 pm

I found another workaround:

When I switch the interface-language to english this problem seems to be away. But for my users it would be easier if I reenable german soon.

Also I fear that there will be problems as soon as someone uses umlauts in an issue.

RE: ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) in several Views - Added by Felix Schäfer at 2012-07-25 03:32 pm

IIRC rails 2.3 is not compatible to 1.9.3 (in the sense that it might work but is not guaranteed to), could you try with 1.9.2?

Furthermore, are you using the mysql, mylsq2 or pg adapter and is your database encoding correct?

RE: ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) in several Views - Added by Norbert Melzer at 2012-07-25 03:46 pm

OK, there is the next problem related to this.

Even with english as the language, I cant create a new issue, perhaps there are other forms not working...

Processing IssuesController#new (for 91.4.8.10 at 2012-07-25 15:34:29) [GET]
  Parameters: {"controller"=>"issues", "action"=>"new", "project_id"=>"webworld"}
Rendering template within layouts/base
Rendering issues/new

ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) on line #25 of app/views/issues/_form.rhtml:
22: </div>
23:
24: <div id="attributes" class="attributes">
25:     <%= render :partial => 'issues/attributes' %>
26: </div>
27:
28: <% if @issue.new_record? %>

    app/views/issues/_form.rhtml:25:in `concat'
    app/views/issues/_form.rhtml:25:in `_run_rhtml_app47views47issues47_form46rhtml_locals_f_form_object'
    app/views/issues/new.rhtml:7:in `block in _run_rhtml_app47views47issues47new46rhtml'
    app/helpers/application_helper.rb:849:in `labelled_tabular_form_for'
    app/views/issues/new.rhtml:3:in `_run_rhtml_app47views47issues47new46rhtml'
    app/controllers/issues_controller.rb:114:in `block (2 levels) in new'
    app/controllers/issues_controller.rb:113:in `new'
    <internal:prelude>:10:in `synchronize'
    passenger (3.0.14) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
    passenger (3.0.14) lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
    passenger (3.0.14) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
    passenger (3.0.14) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
    passenger (3.0.14) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `block in handle_spawn_application'
    passenger (3.0.14) lib/phusion_passenger/utils.rb:470:in `safe_fork'
    passenger (3.0.14) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:180:in `start'
    passenger (3.0.14) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:219:in `block (2 levels) in spawn_rails_application'
    passenger (3.0.14) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:214:in `block in spawn_rails_application'
    passenger (3.0.14) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
    <internal:prelude>:10:in `synchronize'
    passenger (3.0.14) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
    passenger (3.0.14) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
    passenger (3.0.14) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
    passenger (3.0.14) helper-scripts/passenger-spawn-server:99:in `<main>'

Rendering /home/nobbz_de/sites/nobbz.de/subdoms/devel/httpdocs/public/500.html (500 Internal Server Error)

It looks like the same problem, but somewhere else

RE: ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) in several Views - Added by Felix Schäfer at 2012-07-25 03:49 pm

Norbert Melzer wrote:

It looks like the same problem, but somewhere else

It looks like everything you get from the DB is ASCII tagged instead of UTF-8 (meaning: it might be an UTF-8-valid byte stream, but ruby doesn't know it and treats it as ASCII).

Anyway, see the above questions.

RE: ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) in several Views - Added by Norbert Melzer at 2012-07-25 03:51 pm

Felix Schäfer wrote:

IIRC rails 2.3 is not compatible to 1.9.3 (in the sense that it might work but is not guaranteed to), could you try with 1.9.2?

I will try 1.9.2, but could take a while, since I have to reconf the whole server thing and reinstall that bunch of gems…

Anyway, on [[https://www.chiliproject.org/projects/chiliproject/wiki/Installation]] is mentioned, that Chili should work with 1.9.3, so I have choosen this, to stay "at the edge".

Furthermore, are you using the mysql, mylsq2 or pg adapter and is your database encoding correct?

I use mysql and created the database-table as mentioned in the installation page. So I assume that db-encoding is correct.

RE: ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) in several Views - Added by Felix Schäfer at 2012-07-25 03:57 pm

Norbert Melzer wrote:

Felix Schäfer wrote:

IIRC rails 2.3 is not compatible to 1.9.3 (in the sense that it might work but is not guaranteed to), could you try with 1.9.2?

I will try 1.9.2, but could take a while, since I have to reconf the whole server thing and reinstall that bunch of gems…

Anyway, on [[https://www.chiliproject.org/projects/chiliproject/wiki/Installation]] is mentioned, that Chili should work with 1.9.3, so I have choosen this, to stay "at the edge".

Yes, we try to be compatible to 1.9.3, the trial was just to try to confirm that it's not related to 1.9.3 :-)

Furthermore, are you using the mysql, mylsq2 or pg adapter and is your database encoding correct?

I use mysql and created the database-table as mentioned in the installation page. So I assume that db-encoding is correct.

Ah, the mysql gem has been replaced by the mysql2 gem. The mysql gem isn't maintained anymore and is known to not be compatible with 1.9 in many situations. Please change the database adapter from mysql to mysql2 in your conf/database.yml and restart ChiliProject, that should be enough to correct the problem.

RE: ActionView::TemplateError (incompatible character encodings: ASCII-8BIT and UTF-8) in several Views - Added by Norbert Melzer at 2012-07-25 04:14 pm

Felix Schäfer wrote:

Norbert Melzer wrote:

Felix Schäfer wrote:

IIRC rails 2.3 is not compatible to 1.9.3 (in the sense that it might work but is not guaranteed to), could you try with 1.9.2?

I will try 1.9.2, but could take a while, since I have to reconf the whole server thing and reinstall that bunch of gems…

Anyway, on [[https://www.chiliproject.org/projects/chiliproject/wiki/Installation]] is mentioned, that Chili should work with 1.9.3, so I have choosen this, to stay "at the edge".

Yes, we try to be compatible to 1.9.3, the trial was just to try to confirm that it's not related to 1.9.3 :-)

OK, just finished to download and compile 1.9.2-p320, but before installing passenger and rails for that I tried:

Furthermore, are you using the mysql, mylsq2 or pg adapter and is your database encoding correct?

I use mysql and created the database-table as mentioned in the installation page. So I assume that db-encoding is correct.

Ah, the mysql gem has been replaced by the mysql2 gem. The mysql gem isn't maintained anymore and is known to not be compatible with 1.9 in many situations. Please change the database adapter from mysql to mysql2 in your conf/database.yml and restart ChiliProject, that should be enough to correct the problem.

and it works so far. Tried all I know it did not work before. All seems running. I consider this solved.

Thank you!

(1-7/7)