Project

General

Profile

Actions

Defect #10593

closed

Error: 'incompatible character encodings: UTF-8 and ASCII-8BIT' (old annoing issue) on ruby-1.9.3

Added by Alexander Oryol over 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

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!


Related issues

Related to Redmine - Feature #4050: Ruby 1.9 supportClosed2009-10-18

Actions
Actions #1

Updated by Etienne Massip over 12 years ago

  • Status changed from Resolved to New
  • Target version set to 1.4.0
  • Affected version (unused) set to devel

Potential release blocker.

Actions #2

Updated by Alexander Oryol over 12 years ago

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

Actions #3

Updated by Jean-Philippe Lang over 12 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

I was able to reproduce and fixed it in r9330.

Actions #4

Updated by Rodrigo Macedo almost 12 years ago

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.

Actions #5

Updated by Rodrigo Macedo almost 12 years ago

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.

Actions #6

Updated by Rodrigo Macedo almost 12 years ago

I'm using adpater mysql2.

Actions #7

Updated by KK Kon almost 12 years ago

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.

Actions

Also available in: Atom PDF