Coppermine and SMF messes greek fonts when bridged Coppermine and SMF messes greek fonts when bridged
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Coppermine and SMF messes greek fonts when bridged

Started by blackRock, April 09, 2007, 05:08:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackRock

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!

blackRock

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?