Vote #71603
完了Error: 'incompatible character encodings: UTF-8 and ASCII-8BIT' (old annoing issue) on ruby-1.9.3
0%
説明
My instance Redmine was gradually upgraded from 0.7 and older.
When I upgrade to ruby-1.9.3, some projects issues list crashes with 'incompatible character encodings: UTF-8 and ASCII-8BIT'.
The trouble be found in CustomField: Browser (type: list)
In DB possible_values was serialized as:
- !binary |
0J3QtSDQvtC/0YDQtdC00LXQu9C10L0=
and deserialized into string with #Encoding:ASCII-8BIT.
Solution:
$> script/console production
c = CustomField.find(5)
c.possible_values.each {|i| i.force_encoding('UTF-8')}
c.save
Now, value serialized as:
- "\xD0\x9D\xD0\xB5 \xD0\xBE\xD0\xBF\xD1\x80\xD0\xB5\xD0\xB4\xD0\xB5\xD0\xBB\xD0\xB5\xD0\xBD"
and work fine!
journals
Potential release blocker.
--------------------------------------------------------------------------------
This error happen on ruby-1.8.7 too, when I try to edit affected custom field. CustomFieldsController#edit
Which version (Redmine|Ruby) serialize UTF-8 to YAML as binary?
My instance lived initially on ruby-1.8.6
--------------------------------------------------------------------------------
I was able to reproduce and fixed it in r9330.
--------------------------------------------------------------------------------
Hello,
ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
15: </tr></thead>
16: <% enumerations.each do |enumeration| %>
17: <tr class="<%= cycle('odd', 'even') %>">
18: <td><%= link_to h(enumeration), edit_enumeration_path(enumeration) %></td>
19: <td class="center" style="width:15%;"><%= checked_image enumeration.is_default? %></td>
20: <td class="center" style="width:15%;"><%= checked_image enumeration.active? %></td>
21: <td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}, :put) %></td>
app/views/enumerations/index.html.erb:18:in `block (2 levels) in _app_views_enumerations_index_html_erb__76608041_28216668'
app/views/enumerations/index.html.erb:16:in `block in _app_views_enumerations_index_html_erb__76608041_28216668'
app/views/enumerations/index.html.erb:3:in `each'
app/views/enumerations/index.html.erb:3:in `_app_views_enumerations_index_html_erb__76608041_28216668'
app/controllers/enumerations_controller.rb:30:in `index'
I'm using Português(Brasil)
This error occurrs only using Português(Brasil) when I using English this not occurrs.
--------------------------------------------------------------------------------
Hi,
I solved this problem when I changed the driver of mysql.
The driver is here http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick.
--------------------------------------------------------------------------------
I'm using adpater mysql2.
--------------------------------------------------------------------------------
I made migration task
https://github.com/kkkon/redmine_migration_serialize
ruby 1.9.3 change YAML engine default.
Column data that serialized lower ruby 1.9.2 not displayable on ruby 1.9.3
this happen at changed the version of ruby to 1.9.3 from older.
--------------------------------------------------------------------------------
related_issues
relates,Closed,4050,Ruby 1.9 support