Project

General

Profile

Wrong encoding after update to trunk

Added by Philip Taffner about 15 years ago

Hi,

Today I upgraded to the latest trunk version. Everything worked except the encoding/output of the issues and other data from the mysql database.

RAILS_ENV=production script/about
About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.4
Active Record version     2.3.4
Active Resource version   2.3.4
Action Mailer version     2.3.4
Active Support version    2.3.4
Application root          /var/www/redmine/htdocs/redmine-dev
Environment               production
Database adapter          mysql
Database schema version   20091025163651

This is what my redmine output looks like:

And this is what my phpMyAdmin output of the issues table looks:

Everything worked with v0.8.x although the phpMyAdmin looked the same before the update.

I added encoding: utf8 to my database.yml! Same result with and without this option.

I think redmine runs an extra utf8-encode before returning the data?
I'm not a ruby expert, but I can reproduce the result with php when I run a utf8_encode().
When I output the data straight from database, everything looks ok.

Any Ideas?

Thx!


Replies (1)

RE: Wrong encoding after update to trunk - Added by Philip Taffner about 15 years ago

I converted the data with this piece of code. Now the issues look ok in redmine and phpmyadmin.

mysql_query("set names 'utf8'");

$res = mysql_query('SELECT id,description,subject FROM issues');

while($r = mysql_fetch_assoc($res)){
        mysql_query('UPDATE issues SET subject="'.utf8_decode($r['subject']).'", description="'.utf8_decode($r['description']).'" WHERE id='.$r['id']);
}

Do I have to convert all of my tables that way? Why were the data stored in a wrong encoding? Is it a bug from a previous redmine version?

    (1-1/1)