displaying thumb title in UTF displaying thumb title in UTF
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

displaying thumb title in UTF

Started by giorgio79, May 14, 2007, 01:12:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

giorgio79

Hi Guys,

I am using the cpm_getAlbumListFrom, and the thumb title seems to be messed up if the browser is set to display in UTF.

I am also storing in the cpg db the title of pics in UTF8.

Have any of you had this?

Cheers,
Gyuri

Nibbler


giorgio79

Hi Nibbler!

Thanks for coming back. Check it out:

http://www.macadu.hu/test.php

Try changing the encoding to UTF-8 in the browser instead of one of the ISOs.

My cpg album handles fine the titles if the browser is set to UTF8, and my db is UTF8 as well...

I also noted that if the filename has UTF8 chars, like on my test, it cannot be displayed, although if you click on the errored message, cpg album displays it fine.

Cheers,
Gyuri

giorgio79

Hi Nibbler,

I solved this.

I added three lines in the dbconnect function in the cpmfetch_dao.php, so that not only the db, and the display is UTF but the mysql connection as well. This is an old problem, that I first encountered in phpbb. Check out how it looks now, and the pic and the thumb descriptions are showing fine if browser is UTF. :)


here is what I did (see // MY MOD)

function dbConnect ( ) {
   if ($this->dbconnection == "") {

      if (version_compare(phpversion(), "4.2.0", ">=") &&
            strtolower($this->cfg['cfUseExistingDBConnection']) != "true") {
         $this->dbconnection = mysql_connect($this->cfg['dbserver'], $this->cfg['dbuser'], $this->cfg['dbpass'], true);
      } else {
         $this->dbconnection = mysql_connect($this->cfg['dbserver'], $this->cfg['dbuser'], $this->cfg['dbpass']);
      }
      mysql_select_db($this->cfg['dbname'], $this->dbconnection);
// MY MOD
      $utf = mysql_query('SET character_set_client = utf8') or die('Query failed: ' . mysql_error());
         $utf = mysql_query('SET character_set_results = utf8') or die('Query failed: ' . mysql_error());
         $utf = mysql_query('SET character_set_connection = utf8') or die('Query failed: ' . mysql_error());

vuud

Quote from: giorgio79 on May 14, 2007, 05:56:03 PM
Hi Nibbler,

I solved this.

I added three lines in the dbconnect function in the cpmfetch_dao.php, so that not only the db, and the display is UTF but the mysql connection as well. This is an old problem, that I first encountered in phpbb. Check out how it looks now, and the pic and the thumb descriptions are showing fine if browser is UTF. :)


here is what I did (see // MY MOD)

function dbConnect ( ) {
   if ($this->dbconnection == "") {

      if (version_compare(phpversion(), "4.2.0", ">=") &&
            strtolower($this->cfg['cfUseExistingDBConnection']) != "true") {
         $this->dbconnection = mysql_connect($this->cfg['dbserver'], $this->cfg['dbuser'], $this->cfg['dbpass'], true);
      } else {
         $this->dbconnection = mysql_connect($this->cfg['dbserver'], $this->cfg['dbuser'], $this->cfg['dbpass']);
      }
      mysql_select_db($this->cfg['dbname'], $this->dbconnection);
// MY MOD
      $utf = mysql_query('SET character_set_client = utf8') or die('Query failed: ' . mysql_error());
         $utf = mysql_query('SET character_set_results = utf8') or die('Query failed: ' . mysql_error());
         $utf = mysql_query('SET character_set_connection = utf8') or die('Query failed: ' . mysql_error());


Thank you for posting a solution.  I will have to see if I can work this directly into a future release.


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco