forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: nickelas on March 26, 2014, 06:45:22 pm

Title: Search-page with wrong swedish letters
Post by: nickelas on March 26, 2014, 06:45:22 pm
The search-page is displaying swedish characters wrong (the indexed words). Can be seen at: uppsalafoto.se/galleri/search.php
Any tips?
Thanks
Title: Re: Search-page with wrong swedish letters
Post by: gmc on March 27, 2014, 01:08:41 am
Looks like a character set issue...
Several questions:
What charset/collation is used in your MySQL tables?
What charset is specified in cpg config?
Do you have a charset override in config.inc.php? ($dbcharset =)
If you view the keywords in your database via a tool like phpMyAdmin, does it look normal?

I am guessing you are using other than utf8 - the cpg recommended value - and something has 'corrupted' the data.

This thread http://forum.coppermine-gallery.net/index.php/topic,77017.0.html (http://forum.coppermine-gallery.net/index.php/topic,77017.0.html) was my last trip down this road...
Some ideas of how we solved that known the thread.... It was far more than the keywords.

Greg
Title: Re: Search-page with wrong swedish letters
Post by: nickelas on March 27, 2014, 11:01:47 am
Thanks,
If I view the keywords in phpmyadmin they are wrong aswell.. titles too. So it says PÃ¥byggnad instead of Påbyggnad.
Collation looks like it is latin1_swedish_ci.
The charset in the config in cpg is utf-8.
Weird thing is problem only occurs on search-page..
Title: Re: Search-page with wrong swedish letters
Post by: Αndré on March 27, 2014, 02:24:29 pm
I assume you recently updated to cpg1.5.26 and it worked as expected before the upgrade? If so, please read this post (http://forum.coppermine-gallery.net/index.php/topic,76830.msg372140.html#msg372140), apply the patch and report if it fixes your issue.
Title: Re: Search-page with wrong swedish letters
Post by: gmc on March 27, 2014, 03:49:36 pm
Try Αndré's fix first... but since you are seeing 'interesting' data via phpMyAdmin, I am guessing it may not address.

These types of issues have shown themselves in unusual ways...
The last one displayed perfectly fine on one server - but when moved to a new server had the issue...

MySQL appears to try to 'fix' some of the issues - and some system settings appear to be able to influence that... so the errors that appear can seem 'inconsistent'. The view through phpMyAdmin being incorrect is the key I see to say there is a data problem. This should not happen if everything is as it should be...

To correct the data:

SQL to convert to utf-8 (once for each table):
Code: [Select]
ALTER TABLE cpg_albums CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;SQL to 'fix' corrupted data (once for each field to be fixed):
Code: [Select]
UPDATE cpg_albums SET title= CONVERT(CAST(CONVERT(title USING latin1) AS binary) USING utf8);
Try this on one of your tables... If it works, and you want a script to do them all, let me know... I can revise what I used last time.
Let me know your results.

(EDIT: changed $dbcharset to $CONFIG['dbcharset'] to correct previous typo...)
Title: Re: Search-page with wrong swedish letters
Post by: nickelas on April 03, 2014, 05:04:27 pm
Seems the update (1.5.28) solved it.
Title: Re: Search-page with wrong swedish letters
Post by: Αndré on April 03, 2014, 09:01:31 pm
Thanks for the report :)