Search-page with wrong swedish letters Search-page with wrong swedish letters
 

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]

Main Menu

Search-page with wrong swedish letters

Started by nickelas, March 26, 2014, 06:45:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nickelas

The search-page is displaying swedish characters wrong (the indexed words). Can be seen at: uppsalafoto.se/galleri/search.php
Any tips?
Thanks
Human

gmc

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

nickelas

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

Αndré

I assume you recently updated to cpg1.5.26 and it worked as expected before the upgrade? If so, please read this post, apply the patch and report if it fixes your issue.

gmc

#4
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:

  • Backup your CPG tables (or perform this on a test copy)
  • Identify the tables and fields with data issues. These are usually contained to fields accepting user input like album title, picture caption, keywords, even filenames and some config values.
  • Alter the CPG tables to be utf-8. This should be done for all CPG tables.
  • Update the affected fields - converting the data from latin1 to binary to utf-8.
  • If data doesn't view properly, add $CONFIG['dbcharset'] = 'utf8' to config.inc.php

SQL to convert to utf-8 (once for each table):
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):
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...)
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

nickelas

Human

Αndré