[Resolved] Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!!

Added by Robert Murdock almost 7 years ago

Hello,

As Ubuntu 10 is deprecated, i intended to move to another Bitnami VMWare Appliance with a 12 Ubuntu version and 2.2 Redmine.

I've exported my database, imported it in the new server, but all the special characters (french) are not showing up properly.
I already had this problem in the past :
[[http://www.redmine.org/boards/2/topics/21264]]

But this time i took care of everything. Unfortunately, it still produces jibberish.

I checked all my system LANG variables, all the collation / characters of Mysql and so on, and compared it with my previous Ubuntu 10 system (still running). Everything is the SAME. Even with phpmyadmin on each server : characters are showing up the same way. So i should expect the webpage to show up properly !

The only thing i can see is that the HTML source is not the same anymore with the new Redmine version.
PREVIOUS REDMINE VERSION :
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

NEW ONE :
<html lang="en">
<head>
<meta charset="utf-8" />

Is there any small changes in the way Redmine uses charsets ?
I'm lost and dunno what to tune in order to have all my characters showing up properly.

Thanks.

Replies (29)

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

On both servers, it is "InnoDB utf8_general_ci" (please find the attached JPG to confirm, from my phpmyadmin interface).

On the new redmine server, the DB was in latin1 but i changed it when i saw the wrong characters, and also to reflect my previous server configuration to work as many as possible with the same variables to check what was wrong.

Thanks.

charset.JPG (115 KB)

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Robert Murdock wrote:

On the new redmine server, the DB was in latin1 but i changed it when i saw the wrong characters, and also to reflect my previous server configuration to work as many as possible with the same variables to check what was wrong.

Yes but tables are still in latin_1.

You should drop them and re-import your dump.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

Thank you for your help.

I already reimported dozen of times, it is always in latin1 for all tables. And on my previous server it is also in latin1 too (for all tables, but the DB is UTF8).
Are you sure i need to do this ? I need to force the export of the backup in UTF8 then, because it will always produce LATIN1 by default.

But once again, i can do this but why should i change the collation? It works like this in my previous server so i'm not too sure this is the source of the problem ?

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Robert Murdock wrote:

Thank you for your help.

I already reimported dozen of times, it is always in latin1 for all tables. And on my previous server it is also in latin1 too (for all tables, but the DB is UTF8).

Ok, I didn't get that.

What adapter are you using? Maybe you should change fro mysql to mysql2?

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

No problem Etienne :)

I'm already using mysql2, define in the database.yml file as mentionned in the documentation of Redmine.
They said we should update the backup of database.yml by changing the line to mysql2.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Robert Murdock wrote:

No problem Etienne :)

I'm already using mysql2, define in the database.yml file as mentionned in the documentation of Redmine.
They said we should update the backup of database.yml by changing the line to mysql2.

But were you before?

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

Not i was not. The previous server is using mysql.
I've just changed the line back to mysql and restarted everything.

I'm now having an Internal 500 error on the index of Redmine. I understand why they said to update the adapter to mysql2

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

Lots of stuff, but i think the main thing is this line :
Error page : please install the mysql adapter 'gem install activerecord-mysql-adapter' (mysql is not part of the bundle. Add it to gemfile)

I just did this. It installs some stuff. Then i restarted all Bitnami stack but it still gives me a 500 error with the same message.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Robert Murdock wrote:

Lots of stuff, but i think the main thing is this line :
Error page : please install the mysql adapter 'gem install activerecord-mysql-adapter' (mysql is not part of the bundle. Add it to gemfile)

I just did this. It installs some stuff. Then i restarted all Bitnami stack but it still gives me a 500 error with the same message.

Are you on Ruby 1.8?

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

No i can see on the errors that i'm on Ruby 1.9.1. Is that matters ?

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Robert Murdock wrote:

No i can see on the errors that i'm on Ruby 1.9.1. Is that matters ?

Yes, it's not supported (because won't work), see RedmineInstall#Requirements =)

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

I understand.
So i can't use the mysql adapter as i'm using a too recent version of Ruby. I will still use the mysql2 adapter then.
But i still got my accents not showing up properly :(

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Robert Murdock wrote:

I understand.
So i can't use the mysql adapter as i'm using a too recent version of Ruby. I will still use the mysql2 adapter then.

No, you just can't use Redmine with Ruby 1.9.1, it is not meant to work.

You have to upgrade to 1.9.2 or 1.9.3 (preferably the latter).

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Etienne Massip wrote:

Robert Murdock wrote:

No i can see on the errors that i'm on Ruby 1.9.1. Is that matters ?

Thinking of it, if you see "1.9.1" into paths to Gems in logs you have to be careful since it's 1.9.1 on every 1.9.2/1.9.3 setups.

To be sure run ruby --version.

1.9.1 is pretty rare.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

Ruby --version gives 1.9.3 ! =)
I was also searching from my side because i'm using a dedicated Bitnami Redmine appliance for VMWare. I was a little bit surprised it could be offer to download with majors errors in the configuration.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

So you have to use mysql2 adapter in config/database.yml.

What does bundle show gives you (run from Redmine install directory)?

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

Gems included by the bundle:
  * actionmailer (3.2.11)
  * actionpack (3.2.11)
  * activemodel (3.2.11)
  * activerecord (3.2.11)
  * activeresource (3.2.11)
  * activesupport (3.2.11)
  * arel (3.0.2)
  * builder (3.0.0)
  * bundler (1.2.3)
  * coderay (1.0.6)
  * erubis (2.7.0)
  * hike (1.2.1)
  * i18n (0.6.0)
  * journey (1.0.4)
  * jquery-rails (2.0.3)
  * json (1.7.5)
  * mail (2.4.4)
  * mime-types (1.19)
  * multi_json (1.3.6)
  * mysql2 (0.3.11)
  * net-ldap (0.3.1)
  * polyglot (0.3.3)
  * rack (1.4.1)
  * rack-cache (1.2)
  * rack-openid (1.3.1)
  * rack-ssl (1.3.2)
  * rack-test (0.6.1)
  * rails (3.2.11)
  * railties (3.2.11)
  * rake (0.9.2.2)
  * rdoc (3.12)
  * rmagick (2.13.1)
  * ruby-openid (2.1.8)
  * sprockets (2.2.1)
  * thor (0.15.4)
  * tilt (1.3.3)
  * treetop (1.4.10)
  * tzinfo (0.3.33)

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

mysql2 adapter is installed; just put it in your database.yml (don't use mysql adapter which is not compatible with 1.9), restart your server.

If you have 500 then please paste here the contents of the production.log file relative to the error.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

No i don't have errors with mysql2 adapter, it's working fine.
It's only my accents wich are replaced with garbage. Like "société" becomes "société".

In my database it's written the same way. In my old server too. It's just the decoding part that is messy. I don't know what is the difference between my old and new server to not decode the accents properly.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Robert Murdock wrote:

In my database it's written the same way. In my old server too.

What do you mean?

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Robert Murdock almost 7 years ago

I've installed Phpmyadmin on both servers. This way i can see if my tables / entries are the same for the redmine database. And this is the case.
Inside redmine mysql tables, all my accents are replaced with things like "é".
But i think it doesn't matters as my previous server can decode them properly when i go into my redmine projects webpage.

This is what i mean by "it'w written the same way". Visually talking, old server database and new server database are the same.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Etienne Massip almost 7 years ago

Then I suppose you might need to set an encoding for your connection in your database.yml?

Like:

production:
  adapter: mysql2
  ...
  encoding: utf8

I don't use MySQL personally so I don't know a lot about mysql2 adapter config, sorry.

RE: Ubuntu 10. - Redmine 1.3 to Ubuntu 12 - Redmine 2.2 - Wrong charset ?!! - Added by Vincent Mathon almost 7 years ago

I have a similar problem on Win7 with Redmine-2.2.2 packaged with warbler and JRuby 1.7.2 and running on TOMCAT 7.0.35 with a JRE 1.6_31.
Only internationalized labels are affected (I mean, text written in wikis are not affected for instance, but I see "Connecté en tant que admin" instead of "Connecté en tant que admin").

1 2 (1-25/29)