Advanced search  

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

Pages: [1]   Go Down

Author Topic: Charset prouble after move to different server...  (Read 4114 times)

0 Members and 1 Guest are viewing this topic.

heinrich

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Charset prouble after move to different server...
« on: May 27, 2014, 04:42:41 pm »

Hi,

I moved the files and the database from a OpenSuSe apache server to an ubuntu apache server.
I checked that the new mysql server is set to utf8, as was my old one, and the settings all seem fine. However, the äöü-like letters are messed up, if shown in utf8, if i force Firefox to western-charset all looks fine, but I don't know why, since all settings (I know of) are set to utf8.

Any ideas?
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Charset prouble after move to different server...
« Reply #1 on: May 28, 2014, 03:17:28 am »

View the data in the table via a tool like phpMyAdmin.
Does it appear correctly there?

If not, your data is not truly utf8, and needs to be converted.
See post: http://forum.coppermine-gallery.net/index.php/topic,77017.msg373366.html#msg373366

This often shows after a change like a site move - some installations MySQL compensates for the mismatch - others do not.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

heinrich

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: Re: Charset prouble after move to different server...
« Reply #2 on: June 04, 2014, 03:25:03 pm »

View the data in the table via a tool like phpMyAdmin.
Does it appear correctly there?
Yes, it does.

It also shows the fields are utf8_bin format.

I tried the commands from the post you linked, but they cut off all texts at the first special character...
Logged

heinrich

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: Charset prouble after move to different server...
« Reply #3 on: June 04, 2014, 04:05:25 pm »

okay, the problem was solved by adding
$CONFIG['dbcharset'] =                      'utf8';          // Your mysql database charset

to the config file of coppermine, which then is used in a "SET NAMES"-SQL command.

I wonder, why right after the connect, the charset setting isn't collected from the config-table and a "SET NAMES" isn't commanded with that value....
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Charset prouble after move to different server...
« Reply #4 on: June 04, 2014, 07:08:15 pm »

I wonder, why right after the connect, the charset setting isn't collected from the config-table and a "SET NAMES" isn't commanded with that value....
The charset in the config table is used in the html output to tell the browser what charset is used...  The database settings may or may not match this.

It is intended (and in most cases works) that MySQL will obtain the correct charset from the database/table definitions. The ability to add "$CONFIG['dbcharset']" and have the "SET NAMES" issued was to address the cases (like yours) where this doesn't happen for some reason...
MySQL (depending on install options) tries to 'fix' what it sees as charset mismatches - and sometimes chooses incorrectly. In these cases the explicit "SET NAMES" can help.

Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 20 queries.