Project

General

Profile

Actions

Defect #14656

closed

JRuby: Encoding error when creating issues

Added by Vincent Mathon over 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Ruby support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I upgraded from Redmine 1.4.4 to Redmine 2.3.2.
Redmine is built as a war using warbler-1.3.8, JRuby 1.7.2 and run on TOMCAT 7.0.37 with a JVM 1.6.31 on a RHEL 64 bit machine.
The database is a Mysql 5.5.28 and redmine tables are using a charset utf8.
We connect Redmine database with the following database.yml:

production:
   adapter: jdbc
   jndi: java:/comp/env/jdbc/Redmine
   driver: com.mysql.jdbc.Driver

We do sometime observe the following issue:

Encoding::CompatibilityError (incompatible character encodings: ASCII-8BIT and UTF-8):
  app/models/issue.rb:159:in `create_or_update'
  app/controllers/issues_controller.rb:141:in `create'

The last database log before the exception is

INFO:   [1m[36mIssue Load (1.0ms)[0m  [1mSELECT `issues`.* FROM `issues` WHERE `issues`.`root_id` IS NULL ORDER BY `rgt` desc LIMIT 1 FOR UPDATE[0m

Note that we can create issues with all kind of strange characters both in subject and detail. But the following case:

Subject=AS400 : fonctionnement autorisation utilisation email à  revoir
Detail=Rendre pré-alimenter à l'utilisation

fails systematically. If the subject becomes "AS400 : fonctionnement autorisation utilisation" and the detail remains unchanged it works !

As a workaround we can create the issue with the subject and update it with the detail in a second step...


Related issues

Related to Redmine - Defect #14883: Update activerecord-jdbc-adapterClosed

Actions
Actions #1

Updated by Toshi MARUYAMA over 11 years ago

  • Subject changed from Encoding error when creating issues to JRuby: Encoding error when creating issues
  • Category changed from Issues to Ruby support
Actions #2

Updated by Vincent Mathon over 11 years ago

I have solved the problem by upgrading activerecord-jdbc-adapter to version 1.2.7 (this issue seems to be related to an activerecord-jdbc-adapter encoding defect).
To achieve this I have modified two files:

Gemfile

....
platforms :jruby do
  # jruby-openssl is bundled with JRuby 1.7.0
  gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
  gem "activerecord-jdbc-adapter", "1.2.7" 
end
....

and Gemfile.lock

.....
 activerecord (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activerecord-jdbc-adapter (1.2.7)
    activerecord-jdbcmysql-adapter (1.2.7)
      activerecord-jdbc-adapter (~> 1.2.7)
      jdbc-mysql (~> 5.1.0)
....

DEPENDENCIES
  activerecord-jdbc-adapter (= 1.2.7)
....

Sincerly
Vincent MATHON

Actions #3

Updated by Toshi MARUYAMA over 11 years ago

  • Target version set to 2.3.4
Actions #4

Updated by Toshi MARUYAMA over 11 years ago

  • Related to Defect #14883: Update activerecord-jdbc-adapter added
Actions #5

Updated by Toshi MARUYAMA about 11 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Updated jdbc adapter version above 1.2.6 in Gemfile by trunk r12172 and 2.3-stable r12174.

Actions

Also available in: Atom PDF