Charset prouble after move to different server... Charset prouble after move to different server...
 

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

Charset prouble after move to different server...

Started by heinrich, May 27, 2014, 04:42:41 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

heinrich

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?

gmc

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.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

heinrich

Quote from: gmc on May 28, 2014, 03:17:28 AM
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...

heinrich

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....

gmc

Quote from: heinrich on June 04, 2014, 04:05:25 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.

Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money