Messed up encoding

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
karel
New Member
New Member
Posts: 2
Joined: Wed Jun 03, 2009 4:36 pm

Messed up encoding

Post 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?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Messed up encoding

Post by calguy1000 »

My suggestion.

Do some searching in this forum before your post.

The answer has been posted numerous times.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
karel
New Member
New Member
Posts: 2
Joined: Wed Jun 03, 2009 4:36 pm

Re: Messed up encoding

Post 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...
Post Reply

Return to “CMSMS Core”