Page 1 of 1

Messed up encoding

Posted: Wed Jun 03, 2009 4:48 pm
by karel
Hi,

I've "inherited" a relatively large site with CMSMS. I have database dump in utf-8 (and by utf-8 I mean utf-8, because I had to fix it from random encoding "mess") from version 1.4.1. Unfortunately, CMSMS doesn't seem to handle utf-8 properly on my server.

The data in the database is in correct encoding (I checked both from phpmyadmin and mysql command line via ssh), but CMSMS is somehow messing character sets (e.g. displays wrong characters and inserts text in wrong encoding into the database). To check that it's not a problem of the old installation, I tried 1.5.4 clean installation.

Again, whatever I input in the admin (in utf-8) ends up in the database (utf8_general_ci) in some other encoding (wrong characters, or one character replaced by multiple ones). Other software, either mine, or real CMS like Drupal (sorry  :-X) work flawless with no problems with utf-8.

Now, this is usually fixed by executing SET NAMES "UTF-8" before any queries, but I'm either doing it in a wrong place or it is overridden by CMSMS. Any suggestions?

Re: Messed up encoding

Posted: Wed Jun 03, 2009 5:09 pm
by calguy1000
My suggestion.

Do some searching in this forum before your post.

The answer has been posted numerous times.

Re: Messed up encoding

Posted: Wed Jun 03, 2009 7:58 pm
by karel
calguy1000 wrote: My suggestion.

Do some searching in this forum before your post.

The answer has been posted numerous times.
My suggestion: using anything else than Unicode is so 1990's... I did actually search the forum, but saw far too many posts with the same problem, a lot of talking and no real solution (patch etc.) I also tried solving the problem myself first (before asking) somewhere in adodb classes...


File include.php, around lines 130:

Code: Select all

#Load them into the usual variables.  This'll go away a little later on.
global $DONT_LOAD_DB;
if (!isset($DONT_LOAD_DB))
{
    $cmsdb =& $gCms->GetDB();
    $cmsdb->Execute('set names utf8'); // database connection with utf-8    <----------- uncomment this line.
}
Solves the problem...