Defect #13520

Internal Error (incompatible character encodings: ASCII-8BIT and UTF-8) when accessing Admin/Settings, Account, etc.

Added by Ondřej Surý almost 5 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:HighDue date:
Assignee:-% Done:

0%

Category:I18n
Target version:-
Resolution:Invalid Affected version:2.2.3

Description

There's "incompatible character encodings: ASCII-8BIT and UTF-8" error when accessing:

  • Editing a user
  • Create new user
  • Register new user
  • Admin/Settings
  • My account

Data in the database is encoded correctly, so it must be something in the code. I suspect it might be similar to #13354.

There's already discussion on the Forum, here's the link: http://www.redmine.org/boards/1/topics/36573?r=36807

Environment:
Ruby: 1.9.3.0-1ubuntu2.5
Rails: 3.2.12-1~precise+1
Redmine: 2.2.3+dfsg1-1~precise+1
Postgresql: 9.1+129ubuntu1
Database encoding: UTF8 (cs_CZ.utf8 Collate and Ctype)

About your application's environment
Ruby version              1.9.3 (x86_64-linux)
RubyGems version          1.8.11
Rack version              1.4
Rails version             3.2.12
Active Record version     3.2.12
Action Pack version       3.2.12
Active Resource version   3.2.12
Action Mailer version     3.2.12
Active Support version    3.2.12
Application root          /root
Environment               production

There are no third party plugins installed. Database has been migrated, etc.

Admin::Settings

Started GET "/settings" for 2001:1488:ac14:1400:d13c:c0da:c7a:1591 at 2013-03-19 12:10:20 +0100
Processing by SettingsController#index as HTML
  Current user: oerdnj (id=3)
  Rendered settings/_general.html.erb (5.5ms)
  Rendered settings/_display.html.erb (4.5ms)
  Rendered common/_tabs.html.erb (13.2ms)
  Rendered settings/edit.html.erb within layouts/admin (13.6ms)
Completed 500 Internal Server Error in 18ms

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
    11: 
    12: <p><%= setting_select :time_format, Setting::TIME_FORMATS.collect {|f| [::I18n.l(Time.now, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>
    13: 
    14: <p><%= setting_select :user_format, @options[:user_format] %></p>
    15: 
    16: <p><%= setting_check_box :gravatar_enabled %></p>
    17: 
  app/views/settings/_display.html.erb:14:in `block in _app_views_settings__display_html_erb__674035618379178024_39546840'
  app/views/settings/_display.html.erb:1:in `_app_views_settings__display_html_erb__674035618379178024_39546840'
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb__627508277035447565_39247520'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__627508277035447565_39247520'
  app/helpers/application_helper.rb:263:in `render_tabs'
  app/views/settings/edit.html.erb:3:in `_app_views_settings_edit_html_erb__2074124438297187009_39241520'
  app/controllers/settings_controller.rb:26:in `index'

Editing a user:

Started GET "/users/107/edit" for 2001:1488:ac14:1400:79ab:40d8:87cb:6a80 at 2013-03-11 12:50:56 +0100
Processing by UsersController#edit as HTML
  Parameters: {"id"=>"107"}
  Current user: beda (id=10)
  Rendered users/_mail_notifications.html.erb (7.3ms)
  Rendered users/_preferences.html.erb (5.1ms)
  Rendered users/_form.html.erb (18.1ms)
  Rendered users/_general.html.erb (19.4ms)
  Rendered users/_groups.html.erb (8.5ms)
  Rendered users/_memberships.html.erb (76.5ms)
  Rendered common/_tabs.html.erb (107.4ms)
  Rendered users/edit.html.erb within layouts/admin (110.9ms)
Completed 500 Internal Server Error in 174ms

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
    21: </script>
    22:
    23: <% tabs.each do |tab| -%>
    24:   <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ),
    25:                        :id => "tab-content-#{tab[:name]}",
    26:                        :style => (tab[:name] != selected_tab ? 'display:none' : nil),
    27:                        :class => 'tab-content') %>
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb___2669574904331897537_40463380'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb___2669574904331897537_40463380'
  app/helpers/application_helper.rb:263:in `render_tabs'
  app/views/users/edit.html.erb:9:in `_app_views_users_edit_html_erb__1292716952840611560_40398560'

Registering a new user:

Started POST "/account/register" for 2001:1488:ac14:1400:748b:e807:ee3f:35a9 at 2013-03-11 12:47:15 +0100
Processing by AccountController#register as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "user"=>{"login"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "firstname"=>"[FILTERED]", "lastname"=>"[FILTERED]", "mail"=>"[FILTERED]", "language"=>"en", "identity_url"=>""}, "commit"=>"Submit"}
  Current user: anonymous
  Rendered account/register.html.erb within layouts/base (5.1ms)
Completed 500 Internal Server Error in 17ms

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    16: <p><%= f.text_field :firstname, :required => true %></p>
    17: <p><%= f.text_field :lastname, :required => true %></p>
    18: <p><%= f.text_field :mail, :required => true %></p>
    19: <p><%= f.select :language, lang_options_for_select %></p>
    20:
    21: <% if Setting.openid? %>
    22:   <p><%= f.text_field :identity_url  %></p>
  app/views/account/register.html.erb:19:in `block in _app_views_account_register_html_erb__167052182036648489_43437100'
  app/helpers/application_helper.rb:991:in `labelled_form_for'
  app/views/account/register.html.erb:3:in `_app_views_account_register_html_erb__167052182036648489_43437100'

Creating a new user:

Started GET "/users/new" for 217.31.207.1 at 2013-03-11 12:58:29 +0100
Processing by UsersController#new as HTML
  Current user: oerdnj (id=3)
  Rendered users/_mail_notifications.html.erb (1.9ms)
  Rendered users/_preferences.html.erb (5.0ms)
  Rendered users/_form.html.erb (12.6ms)
  Rendered users/new.html.erb within layouts/admin (15.3ms)
  Rendered admin/_menu.html.erb (3.8ms)
  Rendered layouts/base.html.erb (94.9ms)
Completed 500 Internal Server Error in 122ms

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    55:         <%= yield :sidebar %>
    56:         <%= view_layouts_base_sidebar_hook_response %>
    57:     </div>
    58: 
    59:     <div id="content">
    60:         <%= render_flash_messages %>
    61:         <%= yield %>
  app/views/layouts/base.html.erb:58:in `_app_views_layouts_base_html_erb___556530348464672222_26602040'
  app/views/layouts/admin.html.erb:8:in `_app_views_layouts_admin_html_erb___1166907481205184341_39459180'

issue-13520.diff Magnifier (915 Bytes) Toshi MARUYAMA, 2013-03-20 15:47

issue-13520-1.diff Magnifier (1.01 KB) Toshi MARUYAMA, 2013-03-20 18:26

123.jpg - screen (136 KB) anton profit, 2015-02-26 16:03


Related issues

Related to Redmine - Feature #12475: Lazy loading of translation files for faster startup Closed
Duplicated by Redmine - Defect #14710: Settings the left 500 error in ruby1.9.2 Closed

History

#2 Updated by Toshi MARUYAMA almost 5 years ago

  • Category changed from Administration to I18n

#3 Updated by Ondřej Surý almost 5 years ago

Yep, this helps. I can access all those pages now. Thank you.

#4 Updated by Toshi MARUYAMA almost 5 years ago

Could you try this patch instead of note-1 patch?

#5 Updated by Ondřej Surý almost 5 years ago

Toshi MARUYAMA wrote:

Could you try this patch instead of note-1 patch?

Nope, that doesn't help.

Started GET "/my/account" for 109.81.193.205 at 2013-03-20 18:07:19 +0100
Processing by MyController#account as HTML
  Current user: oerdnj (id=3)
  Rendered my/account.html.erb within layouts/base (124.0ms)
Completed 500 Internal Server Error in 146ms

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    16:   <p><%= f.text_field :firstname, :required => true %></p>
    17:   <p><%= f.text_field :lastname, :required => true %></p>
    18:   <p><%= f.text_field :mail, :required => true %></p>
    19:   <p><%= f.select :language, lang_options_for_select %></p>
    20:   <% if Setting.openid? %>
    21:   <p><%= f.text_field :identity_url  %></p>
    22:   <% end %>
  app/views/my/account.html.erb:19:in `block in _app_views_my_account_html_erb__1778295814055381356_47150120'
  app/helpers/application_helper.rb:944:in `labelled_form_for'
  app/views/my/account.html.erb:9:in `_app_views_my_account_html_erb__1778295814055381356_47150120'
Started GET "/users/new" for 109.81.193.205 at 2013-03-20 18:08:21 +0100
Processing by UsersController#new as HTML
  Current user: oerdnj (id=3)
  Rendered users/_mail_notifications.html.erb (1.9ms)
  Rendered users/_preferences.html.erb (4.6ms)
  Rendered users/_form.html.erb (12.2ms)
  Rendered users/new.html.erb within layouts/admin (14.5ms)
  Rendered admin/_menu.html.erb (3.8ms)
  Rendered layouts/base.html.erb (34.8ms)
Completed 500 Internal Server Error in 59ms

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    55:         <%= yield :sidebar %>
    56:         <%= view_layouts_base_sidebar_hook_response %>
    57:     </div>
    58: 
    59:     <div id="content">
    60:         <%= render_flash_messages %>
    61:         <%= yield %>
  app/views/layouts/base.html.erb:58:in `_app_views_layouts_base_html_erb___3464178119876434098_27342580'
  app/views/layouts/admin.html.erb:8:in `_app_views_layouts_admin_html_erb___2226765504173015874_52341820'
Started GET "/account/register" for 109.81.193.205 at 2013-03-20 18:08:43 +0100
Processing by AccountController#register as HTML
  Current user: oerdnj (id=3)
  Rendered account/register.html.erb within layouts/base (6.9ms)
Completed 500 Internal Server Error in 52ms

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    55:         <%= yield :sidebar %>
    56:         <%= view_layouts_base_sidebar_hook_response %>
    57:     </div>
    58: 
    59:     <div id="content">
    60:         <%= render_flash_messages %>
    61:         <%= yield %>
  app/views/layouts/base.html.erb:58:in `_app_views_layouts_base_html_erb___3464178119876434098_27342580'
Started GET "/settings" for 109.81.193.205 at 2013-03-20 18:09:04 +0100
Processing by SettingsController#index as HTML
  Current user: oerdnj (id=3)
  Rendered settings/_general.html.erb (25.3ms)
  Rendered settings/_display.html.erb (87.2ms)
  Rendered common/_tabs.html.erb (122.5ms)
  Rendered settings/edit.html.erb within layouts/admin (125.9ms)
Completed 500 Internal Server Error in 162ms

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
    11: 
    12: <p><%= setting_select :time_format, Setting::TIME_FORMATS.collect {|f| [::I18n.l(Time.now, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>
    13: 
    14: <p><%= setting_select :user_format, @options[:user_format] %></p>
    15: 
    16: <p><%= setting_check_box :gravatar_enabled %></p>
    17: 
  app/views/settings/_display.html.erb:14:in `block in _app_views_settings__display_html_erb___74934282724677793_50957240'
  app/views/settings/_display.html.erb:1:in `_app_views_settings__display_html_erb___74934282724677793_50957240'
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb__2902838862237008963_50128280'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__2902838862237008963_50128280'
  app/helpers/application_helper.rb:271:in `render_tabs'
  app/views/settings/edit.html.erb:3:in `_app_views_settings_edit_html_erb__2285893890726478615_47564320'
  app/controllers/settings_controller.rb:28:in `index'

#6 Updated by Toshi MARUYAMA almost 5 years ago

Could you try this patch instead of note-4 patch?

#7 Updated by Ondřej Surý almost 5 years ago

Toshi MARUYAMA wrote:

Could you try this patch instead of note-4 patch?

Still nothing and the error message still looks same.

#8 Updated by Toshi MARUYAMA over 4 years ago

Could you add "# encoding: utf-8" at top of lib/redmine/i18n.rb on clean Redmine source (not apply any patches)?

trunk / 2.3-stable (Copyright (C) 2006-2013 Jean-Philippe Lang)

diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb
--- a/lib/redmine/i18n.rb
+++ b/lib/redmine/i18n.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+#
 # Redmine - project management software
 # Copyright (C) 2006-2013  Jean-Philippe Lang
 #

2.2-stable (Copyright (C) 2006-2012 Jean-Philippe Lang)

diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb
--- a/lib/redmine/i18n.rb
+++ b/lib/redmine/i18n.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+#
 # Redmine - project management software
 # Copyright (C) 2006-2012  Jean-Philippe Lang
 #

#9 Updated by Ondřej Surý over 4 years ago

Nope :(.

Started GET "/settings" for 2001:1488:ac14:1400:e017:810a:d3a5:63c0 at 2013-03-21 08:11:02 +0100
Processing by SettingsController#index as HTML
  Current user: oerdnj (id=3)
  Rendered settings/_general.html.erb (5.4ms)
  Rendered settings/_display.html.erb (4.3ms)
  Rendered common/_tabs.html.erb (12.8ms)
  Rendered settings/edit.html.erb within layouts/admin (13.1ms)
Completed 500 Internal Server Error in 18ms

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
    11: 
    12: <p><%= setting_select :time_format, Setting::TIME_FORMATS.collect {|f| [::I18n.l(Time.now, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>
    13: 
    14: <p><%= setting_select :user_format, @options[:user_format] %></p>
    15: 
    16: <p><%= setting_check_box :gravatar_enabled %></p>
    17: 
  app/views/settings/_display.html.erb:14:in `block in _app_views_settings__display_html_erb__382735947259716240_55203920'
  app/views/settings/_display.html.erb:1:in `_app_views_settings__display_html_erb__382735947259716240_55203920'
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb__4495962974242832258_54203740'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__4495962974242832258_54203740'
  app/helpers/application_helper.rb:271:in `render_tabs'
  app/views/settings/edit.html.erb:3:in `_app_views_settings_edit_html_erb__2259510847400200366_36055040'
  app/controllers/settings_controller.rb:28:in `index'

Is there any way how to help you with debugging this issue? I could provide you with my configs (I am running redmine under thin), some database tables, etc.

#10 Updated by Toshi MARUYAMA over 4 years ago

I don't know about ubuntu.
Is "Ruby: 1.9.3.0-1ubuntu2.5" recent Ruby?

#11 Updated by Etienne Massip over 4 years ago

Did you run cleanup after upgrade?

Dumb question which I have to ask: did you restart thin after applying patches?

#12 Updated by Ondřej Surý over 4 years ago

  • Status changed from New to Resolved

Etienne Massip wrote:

Did you run cleanup after upgrade?

Well I did (and the package does that automatically), but it turns out, that tmp:cache:clear command is broken in the pre-packaged version of redmine, and the cache wasn't cleared as it should be.

After I have manually removed contents of /var/cache/redmine/ everything works as it should be.

Sorry for the trouble and I am going to fix the redmine package.

#13 Updated by Etienne Massip over 4 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Invalid

#14 Updated by Ondřej Surý over 4 years ago

Just a quick notice. The real problem isn't in redmine or the packaging, but there's a bug in the rails rake task which ignores settings in the config.paths["tmp"], not to mention session_store, etc. and just mindlessly deletes "tmp/cache" content:

  namespace :cache do
    # desc "Clears all files and directories in tmp/cache" 
    task :clear do
      FileUtils.rm_rf(Dir['tmp/cache/[^.]*'])
    end
  end

and it needs to be something more like

  namespace :cache do
    # desc "Clears all files and directories in tmp/cache" 
    task :clear do
      FileUtils.rm_rf(Dir[File.join(Rails.configuration.path["tmp"],'cache/[^.]*']))
    end
  end

#15 Updated by Etienne Massip over 4 years ago

Rails.configuration.paths is an undocumented property so I'm not sure you're supposed to manipulate it?

#16 Updated by Ondřej Surý over 4 years ago

Etienne Massip wrote:

Rails.configuration.paths is an undocumented property so I'm not sure you're supposed to manipulate it?

Unfortunatelly that's something we have to live with, since rails apps are not FHS compliant (mixing static data with volatile data – that doesn't go well with traditional distributions, multiple partitions, etc.).

And to tell the truth, it's something I just came to, since those modification were already in the place, when I started helping with redmine packaging for Debian. The good thing is that we can have more instances from same sources, the bad thing is that it breaks sometimes.

I know it's hard to all parties (upstream, distributions and users). And Ruby packaging is especially hard because there's clash in two different approaches (gem and deb).

But all I can do is to cope with that, because our (Debian) users want pre-packaged redmine. And apologize when our changes for packaging break something.

BTW I might be missing something, but http://api.rubyonrails.org/classes/Rails/Engine/Configuration.html#method-i-paths seems to be documented.

Anyway the good side is that I have modified the redmine package to clear the cache on every upgrade and it finally works. Thanks for your time.

#17 Updated by Nedyalko Zhekov over 4 years ago

Hi there. I'm new to ruby & rails and just want to contribute my experience to the redmine community.

I had a very similar problem after an upgrade from 1.1.2 to 2.3.1 on Debian Wheezy. I followed the upgrade instructions on the redmine.org page
http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade.

The problem was occuring only on pages requiring the same database tables. For example if you go to the settings page there wasn't any problem but if you go to an issue page an error occured.

My environment (./script/about)
Environment:
Redmine version 2.3.1.stable
Ruby version 1.9.3 (x86_64-linux)
Rails version 3.2.13
Environment production
Database adapter Mysql2
Redmine plugins:
no plugin installed

The error message I got in the redmine log (log/production.log)
ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
30: <% previous_group = group >
31: <
end >
32: <tr id="issue-<
= issue.id >" class="hascontextmenu <= cycle('odd', 'even') > <= issue.css_classes > <= level > 0 ? "idnt idnt-#{level}" : nil >">
33: <td class="checkbox hide-when-print"><
= check_box_tag("ids[]", issue.id, false, :id => nil) ></td>
34: <
= raw query.inline_columns.map {|column| "<td class=\"#{column.css_classes}\">#{column_content(column, issue)}</td>"}.join >
35: </tr>
36: <
@query.block_columns.each do |column|
app/views/issues/_list.html.erb:33:in `block (2 levels) in app_views_issues_list_html_erb__796519447520383731_58016060'
app/helpers/issues_helper.rb:29:in `block in issue_list'
app/helpers/issues_helper.rb:25:in `each'
app/helpers/issues_helper.rb:25:in `issue_list'
app/views/issues/_list.html.erb:18:in `block in app_views_issues_list_html_erb__796519447520383731_58016060'
app/views/issues/_list.html.erb:1:in `_app_views_issues__list_html_erb__796519447520383731_58016060'
app/views/issues/index.html.erb:62:in `_app_views_issues_index_html_erb___1459416343466838695_57006680'
app/controllers/issues_controller.rb:83:in `block (2 levels) in index'
app/controllers/issues_controller.rb:82:in `index'

My solution
After looking for about 12 hours in the logs I fixed my problem. I've installed the gem package mysql2 and then changed the adapter in config/database.yml to mysql2. That solved the problem. I hope this can save you some hours in looking for a solution.

config/database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: xxxxxxxx
password: xxxxxxxx
encoding: utf8

$ gem list | grep mysql
mysql (2.8.1)
mysql2 (0.3.11)

#18 Updated by Ladislav Nesnera over 4 years ago

Big thanks Nedyalko - your advice (change adapter: mysql to mysql2) solved also my problem (upgrade from 1.4.4 to 2.3.1).

#19 Updated by Cuong Nguyen over 4 years ago

Thanks, Nedyalko! I works in my case (2.3.1).

I met the same problem after upgrading from Debian 6 to 7 (Wheezy).

#20 Updated by Toshi MARUYAMA over 4 years ago

  • Duplicated by Defect #14710: Settings the left 500 error in ruby1.9.2 added

#21 Updated by Scott Van Wart over 4 years ago

I was getting a segfault with Redmine 2.0.3 and Ruby 1.8.7, so I updated to Redmine 2.3.2 and Ruby 1.9.3. Then I got this:

Started GET "/issues/437" for 127.0.0.1 at 2013-08-20 16:47:45 -0300
Processing by IssuesController#show as HTML
  Parameters: {"id"=>"437"}
  Current user: scott (id=1)
  Rendered issues/_action_menu.html.erb (6.2ms)
  Rendered issues/show.html.erb within layouts/base (37.4ms)
Completed 500 Internal Server Error in 119ms

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    78:
    79:   <p><strong><%=l(:field_description)%></strong></p>
    80:   <div class="wiki">
    81:   <%= textilizable @issue, :description, :attachments => @issue.attachments %>
    82:   </div>
    83: </div>
    84: <% end %>
  app/views/issues/show.html.erb:81:in `_app_views_issues_show_html_erb___3362741532134977815_56752880'
  app/controllers/issues_controller.rb:119:in `block (2 levels) in show'
  app/controllers/issues_controller.rb:116:in `show'

I did as suggested in update #13520-16 and it solved my problem.

#22 Updated by Michael C over 4 years ago

Hello!

I've got this error for new Redmine 2.3.2 installation. I've tried all the patched and methods which has been described above, but nothing helped. I can not solve it for a whole day so I'm writing here.

Here is my Ruby: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Mysql 5.0.95 for redhat-linux-gnu (x86_64) (driver "mysql2" in redmine)
Database with utf8 uncoding
Redmine 2.3.2

I created new issue in Russian language and get 500 error when try to view it:

Internal error
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.
If you are the Redmine administrator, check your log files for details about the error.

Here is the data from Log:

Connecting to database specified by database.yml
OpenIdAuthentication.store is nil. Using in-memory store.
Creating scope :system. Overwriting existing method Enumeration.system.
Creating scope :sorted. Overwriting existing method Group.sorted.
Creating scope :sorted. Overwriting existing method User.sorted.
Started GET "/issues/2" for 1.2.3.4 at 2013-09-03 22:15:30 +0000
Processing by IssuesController#show as HTML
  Parameters: {"id"=>"2"}
  Current user: Michael (id=5)
  Rendered issues/_action_menu.html.erb (14.6ms)
  Rendered issues/show.html.erb within layouts/base (29.4ms)
Completed 500 Internal Server Error in 814ms

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    22:   <%= avatar(@issue.author, :size => "50") %>
    23:
    24: <div class="subject">
    25: <%= render_issue_subject_with_tree(@issue) %>
    26: </div>
    27:         <p class="author">
    28:         <%= authoring @issue.created_on, @issue.author %>.
  app/views/issues/show.html.erb:25:in `_app_views_issues_show_html_erb__4258364884133161359_23990214715200'
  app/controllers/issues_controller.rb:119:in `block (2 levels) in show'
  app/controllers/issues_controller.rb:116:in `show'

I'ready to help with any experiments or testing, if you need, I can get you an access to the stand.

#23 Updated by meta tech about 3 years ago

I tried all suggestions in this post.
The only fix that works is here below.
I am surprised that it is not included in the latest version (2.6.0)

--- redmine/app/helpers/application_helper.rb
+++ redmine/app/helpers/application_helper.rb
@ -925,7 +925,8 @ module ApplicationHelper
end

def lang_options_for_select(blank=true)
- (blank ? [["(auto)", ""]] : []) + languages_options
+ (blank ? [["(auto)", ""]] : [])
valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.last <=> y.last }
end

P.S. : I am using Redmine 2.5.0, and the error appeared after a migration from Ruby 1.8 to 1.9.3.

#24 Updated by Anonymous almost 3 years ago

Have the same issue. Applied patch of "meta tech" and it helped. The problem appeared on ruby of version 2.1.0 and redmine version 2.6.0.

#25 Updated by Jean-Philippe Lang almost 3 years ago

Dastan Kozhomuratov wrote:

Have the same issue. Applied patch of "meta tech" and it helped. The problem appeared on ruby of version 2.1.0 and redmine version 2.6.0.

r13807 should fix this error.

#26 Updated by Sergey T almost 3 years ago

Ruby 2.1.5 and Redmine v 2.6.0 (r13807)

Here is the data from Log:

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    27:   <tbody>
    28: <% project_tree(@projects) do |project, level| %>
    29:   <tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
    30:   <td class="name"><span><%= link_to_project_settings(project, {}, :title => project.short_description) %></span></td>
    31:   <td><%= checked_image project.is_public? %></td>
    32:   <td><%= format_date(project.created_on) %></td>
    33:   <td class="buttons">
  app/views/admin/projects.html.erb:30:in `block in _app_views_admin_projects_html_erb___1335584868889568955_70054962614940'
  app/models/project.rb:765:in `block in project_tree'
  app/models/project.rb:761:in `each'
  app/models/project.rb:761:in `project_tree'
  app/helpers/application_helper.rb:374:in `project_tree'
  app/views/admin/projects.html.erb:28:in `_app_views_admin_projects_html_erb___1335584868889568955_70054962614940'

#27 Updated by Tobias Fischer almost 3 years ago

Hi Jean-Philippe,

unfortunately your patch from r13807 doesn't fix the issue for repositories in v2.6.1 (see #16881).
Any chance to include the patch from #16881 in one of the next versions?

Thanks!

#28 Updated by Toshi MARUYAMA almost 3 years ago

Tobias Fischer wrote:

Hi Jean-Philippe,

unfortunately your patch from r13807 doesn't fix the issue for repositories in v2.6.1 (see #16881).
Any chance to include the patch from #16881 in one of the next versions?

#16881 is not related with this issue.

#29 Updated by Toshi MARUYAMA almost 3 years ago

Sergey T wrote:

Ruby 2.1.5 and Redmine v 2.6.0 (r13807)

Here is the data from Log:

[...]

This is not related with this issue.

#30 Updated by anton profit almost 3 years ago

The same problem.

Environment:
Redmine version 3.0.0.stable.14044
Ruby version 2.1.5-p273 (2014-11-13) [x86_64-linux-gnu]
Rails version 4.2.0
Environment development
Database adapter Mysql2
SCM:
Subversion 1.6.17
Git 1.7.9.5
Filesystem
Redmine plugins:
no plugin installed

#31 Updated by Lya D almost 3 years ago

I had the same problem and this solution is working for me :

Check your linux locales :

dpkg-reconfigure locales

Check your locale

Generating locales (this might take a while)...
fr_FR.UTF-8... done

Delete your redmine cache

mv /path/to/redmine/tmp/cache /path/to/redmine/tmp/cache.old
mkdir /path/to/redmine/tmp/cache
chown youruser /path/to/redmine/tmp/cache

Restart apache (restart redmine)

#32 Updated by José Nunes de Oliveira Neto over 2 years ago

I'm on Ubuntu 14.04.

I updated my redmine 2.4 to last stable 2.5.1 with Ondrej PPA and after, i got the same error.

So, i did the following commands:

$ apt-get install ruby-mysql2
$ gem install mysql2

And i change my database.yml to

adapter: mysql2

After Apache restarts, i did my redmine instance work.

#33 Updated by Toshi MARUYAMA over 2 years ago

anton profit wrote:

The same problem.
123.jpg

Your problem is fixed by #19305.

#34 Updated by Alexandre Rock Ancelet over 2 years ago

Actually, I've just migrated from Redmine 2.6 to 3.1 and I ran into this problem on messages#show and wiki#show.

Using dpkg-reconfigure locales solution proposed by @Lya D worked for me !

Any other solution did not work.

If it can help anyone coming back into this issue.

Environment:
  Redmine version                3.1.0.stable.14479
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  4.2.3
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.17
  Git                            1.9.1
  Filesystem                     
Redmine plugins:
  redmine_checklists             3.1.0
  redmine_custom_css             0.1.6
  redmine_dmsf                   1.5.2
  redmine_exception_handler      2.0.0.devel.eb74a043bd
  redmine_spent_time_in_issue_description 2.6
  redmine_zenedit                0.0.2

Errors I had before solving the bug:

An ActionView::Template::Error occurred in wiki#show:
incompatible character encodings: UTF-8 and ASCII-8BIT
app/helpers/application_helper.rb:914:in `block in parse_headings'
---
An ActionView::Template::Error occurred in messages#show:
incompatible character encodings: UTF-8 and ASCII-8BIT
app/views/messages/show.html.erb:66:in `block in _app_views_messages_show_html_erb__1670534409470203738_62374345629360'

#35 Updated by Eugen Funk over 2 years ago

same here:

  Rendered projects/show.html.erb within layouts/base (403.2ms)
Completed 500 Internal Server Error in 2871ms (ActiveRecord: 65.7ms)

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    62: </div>
    63: 
    64: <div class="splitcontentright">
    65:   <%= render :partial => 'members_box' %>
    66: 
    67:   <% if @news.any? && authorize_for('news', 'index') %>
    68:   <div class="news box">
  app/views/projects/show.html.erb:65:in `_app_views_projects_show_html_erb__2186080689967109683_38420520'
  app/controllers/projects_controller.rb:153:in `show'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

after calling
sudo dpkg-reconfigure locales

I receive
Generating locales...
  de_DE.UTF-8... up-to-date
  en_US.ISO-8859-1... up-to-date
  en_US.ISO-8859-15... up-to-date
  en_US.UTF-8... up-to-date
  hu_HU.ISO-8859-2... up-to-date
  hu_HU.UTF-8... up-to-date
Generation complete.

but the error is still there.
However, when I installed redmine, sudo dpkg-reconfigure locales returned errors about not selected language.
Maybe I miss how to reset the cache? The commands provided by @Lya-D didnt work.

Also available in: Atom PDF