coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 bridging => Topic started by: blackRock on April 09, 2007, 05:08:18 PM

Title: Coppermine and SMF messes greek fonts when bridged
Post by: blackRock on April 09, 2007, 05:08:18 PM
I have the following issue when trying to bridge coppermine 1.4.10 and SMF 1.1.2:

I use the same database for both Coppermine and SMF in a local machine. I use greek as my language for both of them.
The table collation for coppermine is utf8_unicode_ci and works great when it is not bridged.
The table collation for coppermine is utf8_general_ci and also works great when it is not bridged.

The problem appears when I bridge them. SMF continues to work fine, but in Coppermine everything that comes from the database, such as categories and album names, appears like this: ΕσωÏ,,ερικοί Χώροι

I've tried to make SMF having the same collation as Coppermine but it didn't work. The problem becomes the reverse. SMF cannot show properly the characters.
In a topic I found that I should find in smf10.inc.php
$this->connect($db_connection);
and replace it with
$this->connect($db_connection);
cpg_db_query("SET NAMES DEFAULT", $this->link_id);

but it did not do anything.

Coppermine install: http://localhost/cpg/
Forum install: http://localhost/forum/
Coppermine version: cpg1.4.10
Forum version: SMF 1.1.2
Test user account: -

BridgeManager settings:
Forum URL:  http://localhost/forum
Relative path to your BBS's config file:  ../forum/
Use post-based groups?:  0

Thanks in advance!
Title: Re: Coppermine and SMF messes greek fonts when bridged
Post by: blackRock on April 10, 2007, 09:41:07 AM
I solved it!

In file functions.inc.php, in function cpg_db_connect() I added mysql_query("SET NAMES utf8", $result); before return $result;

Before:
function cpg_db_connect()
{
        global $CONFIG;
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
        if (!$result) {
                return false;
        }
        if (!mysql_select_db($CONFIG['dbname']))
                return false;


return $result;
}


After:
function cpg_db_connect()
{
        global $CONFIG;
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
        if (!$result) {
                return false;
        }
        if (!mysql_select_db($CONFIG['dbname']))
                return false;

mysql_query("SET NAMES utf8", $result);
return $result;
}


The only problem was that everything was stored in database in greek got destroyed, but everything i store after the change works ok!

Although it works, is it a proper solution?