Advanced search  

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]

Pages: [1]   Go Down

Author Topic: displaying thumb title in UTF  (Read 4415 times)

0 Members and 1 Guest are viewing this topic.

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
displaying thumb title in UTF
« on: May 14, 2007, 01:12:09 am »

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
Logged

Nibbler

  • Guest
Re: displaying thumb title in UTF
« Reply #1 on: May 14, 2007, 02:16:02 am »

A link might help.
Logged

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: displaying thumb title in UTF
« Reply #2 on: May 14, 2007, 08:21:55 am »

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
Logged

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: displaying thumb title in UTF
« Reply #3 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());
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: displaying thumb title in UTF
« Reply #4 on: May 29, 2007, 11:05:04 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.


Logged
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
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.