Vote #74243
完了JRuby: Encoding error when creating issues
0%
説明
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...
journals
--------------------------------------------------------------------------------
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":https://github.com/jruby/activerecord-jdbc-adapter/issues/229 encoding defect).
To achieve this I have modified two files:
*Gemfile*
<pre>
....
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
....
</pre>
and *Gemfile.lock*
<pre>
.....
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)
....
</pre>
<pre>
DEPENDENCIES
activerecord-jdbc-adapter (= 1.2.7)
....
</pre>
Sincerly
Vincent MATHON
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Updated jdbc adapter version above 1.2.6 in Gemfile by trunk r12172 and 2.3-stable r12174.
--------------------------------------------------------------------------------
related_issues
relates,Closed,14883,Update activerecord-jdbc-adapter