Project

General

Profile

Invalid byte sequence error

Added by Peter Todorov almost 11 years ago

Hi,

I'm getting 500 internal server error when opening the issues tab of one of my projects.
The production log says: ActionView::Template::Error (invalid byte sequence in UTF-8)
There was a thread here about the same problem and the problem was the version of jruby.
I've upgraded to jruby 1.7.8 but the issue is still there. Do I have to "tell" somehow to
redmine to use the new jruby version? To upgrade it I've installed rvm.. not sure if that
has something to do with it. Also I've installed redmine using a normal user on the system
and then upgraded jruby as root.

root@darkstar:/usr/share/redmine-2.4.1# ruby --version
jruby 1.7.8 (1.9.3p392) 2013-11-14 0ce429e on OpenJDK 64-Bit Server VM 1.7.0_25-b30 [linux-amd64]

root@darkstar:/usr/share/redmine-2.4.1# rails --version
Rails 3.2.15

root@darkstar:/usr/share/redmine-2.4.1# uname -a
Linux darkstar 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

root@darkstar:/usr/share/redmine-2.4.1# mysql --version
mysql Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (x86_64) using readline 6.2

For a webserver I'm running Apache/2.2.22 with mod passenger

Here is the full log:

Started GET "/projects/clubview/issues" for 93.123.106.120 at 2013-11-27 16:47:42 +0200
Processing by IssuesController#index as HTML
Parameters: {"project_id"=>"clubview"}
Current user: ptodorov (id=3)
Rendered queries/_filters.html.erb (20.2ms)
Rendered queries/_columns.html.erb (3.5ms)
Rendered issues/_list.html.erb (90.2ms)
Rendered issues/index.html.erb within layouts/base (121.1ms)
Completed 500 Internal Server Error in 218.2ms

ActionView::Template::Error (invalid byte sequence in UTF-8):
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/helpers/queries_helper.rb:96:in `column_value'
app/helpers/queries_helper.rb:88:in `column_content'
app/views/issues/_list.html.erb:33:in `block (3 levels) in app_views_issues_list_html_erb__1622246316583783127_41160100'
app/views/issues/_list.html.erb:33:in `map'
app/views/issues/_list.html.erb:33:in `block (2 levels) in app_views_issues_list_html_erb__1622246316583783127_41160100'
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__1622246316583783127_41160100'
app/views/issues/_list.html.erb:1:in `_app_views_issues__list_html_erb__1622246316583783127_41160100'
app/views/issues/index.html.erb:62:in `_app_views_issues_index_html_erb__881776694238606499_25922580'
app/controllers/issues_controller.rb:83:in `block (2 levels) in index'
app/controllers/issues_controller.rb:82:in `index'

Thanks a ton in advance!


Replies (1)

RE: Invalid byte sequence error - Added by Peter Todorov almost 11 years ago

I've finally found the origins of the problem.
Someone copy-pasted a string with broken utf-8 characters in the issue subject and it ended up in the database.
Here is the mysql query to locate the issues with invalid characters in the subject:

SELECT
CONVERT(
CONVERT
USING latin1 ) AS latin1,
CONVERT(
CONVERT
USING utf8 ) AS utf8
FROM
issues
WHERE
CONVERT RLIKE CONCAT , '-', UNHEX , ']' )

This finds strings that are different in utf8 and latin1.

    (1-1/1)