forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: Thommy on May 03, 2017, 01:00:23 pm

Title: Wrong Chars (Ä.Ü.Ö just on User Names
Post by: Thommy on May 03, 2017, 01:00:23 pm
Regards @all Supporters

Sorry for Query Post, but on German Support is (maybe Busy at the Moment) Nobody present.
(http://forum.coppermine-gallery.net/index.php/topic,79038.msg383144/topicseen.html#msg383144)

So I try to get Help this Way.

No here's my Prolem:

Coppermine Version 1.5.40 with Theme Dark Velvet from Markus is installed and Running.
I've a Second Database  with SQL Trigger to Copy from WebApp to Copermine for Insert New Users.
Charset of both Databases is utf8_unicode_ci and and also Header on Page is set to <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

All Chars on Gallery are shown correctly, ONLY User "special" Chars (Ä,Ü,Ö) are wrong

So set Name "Dörte" in SQL Database "user_name" is shown as "D�rte" in Online View.
ONLY Usernames are affected, Rest on Gallery are looking good.

Any Ideas what's the Problem there ?

Thank you and best Reagrads
Thomas
Title: Re: Wrong Chars (Ä.Ü.Ö just on User Names
Post by: phill104 on May 03, 2017, 09:12:29 pm
Could you upgrade to 1.5.46 first so you are running the latest version.
Title: Re: Wrong Chars (Ä.Ü.Ö just on User Names
Post by: gmc on May 04, 2017, 07:45:45 pm
There is a config variable that can be specified in include/config.inc.php that will override the mysql charset in the event your installation doesn't seem to be recognizing it correctly.. (even though you say the DB is defined correctly - sometimes MySQL ends up with a wrong result... The variable was added to address this possibility.)

If you add:
Code: [Select]
$CONFIG['dbcharset'] =                      'utf8';          // Your mysql database charsetto include/config.inc.php - CPG will issue an explicit SET NAMES command to MySQL as part of establishing the connection.  See if this corrects your issue...

(It would typically show in other areas as well - IF you have used special characters in album titles, descriptions, etc...)

Title: Re: Wrong Chars (Ä.Ü.Ö just on User Names
Post by: Thommy on May 04, 2017, 10:12:47 pm
Hello and THX 4 Help

After Update to 1.5.46 (stable) and Change
Code: [Select]
$CONFIG['dbcharset'] =                      'utf8';

All Usernames are shown correctly. But now ALL "special characters" in Gallery like the Description Text are wrong shown.

Ü is like ü
Ö is like ö

But (I'm wondering) Ä is looking correctly

Regards
Thomas
Title: Re: Wrong Chars (Ä.Ü.Ö just on User Names
Post by: gmc on May 05, 2017, 07:27:26 pm
Then you have a mismatch of charsets in your data... It can be fixed, but there is some trial and error required.
I strongly suggest starting with a backup copy of your database.

This post indicates what is needed - the thread contains the detailed steps in how we arrived there:
http://forum.coppermine-gallery.net/index.php/topic,77017.msg373366.html#msg373366 (http://forum.coppermine-gallery.net/index.php/topic,77017.msg373366.html#msg373366)

Best suggestion I can give:
We know usernames displays properly when retrieved with charset utf8... Need to identify the charset that will properly display the remaining info... I'd suggest trying different values for the 'dbcharset' variable you added to see what works (of course usernames likely won't display properly)  I'd start with 'latin1' - and go from there...
A 'SHOW CHARACTER SET' command can be used to give you the valid choices.

The SQL command to correct EACH column (from the other thread) would be:
Code: [Select]
UPDATE tablename SET columnname= CONVERT(CAST(CONVERT(columnname USING charset) AS binary) USING utf8);tablename, columnname, and charset need to be set appropriately...

Breaking that command up - inner CONVERT will read the data using the specified charset (whatever worked to properly display the data) - it then CASTs it as binary data - and then CONVERTs it to UTF8 - and assigns the value back to the original field - for the entire table - all in one statement.

The only rows that will show as updated are those with incorrectly translated data.
Title: Re: Wrong Chars (Ä.Ü.Ö just on User Names
Post by: Thommy on May 05, 2017, 10:26:37 pm
Hi GMC

Problem [SOLVED]  ;D
Changing ALL Tables from "utf8_unicode_ci" to "utf8 bin"
Just some Description Text I've overwrite "manually"
News Users are Correctly insert in DB also when taken "special characters" like Ä,Ü,Ö

THX a lot for Help
Best regards from Germany
Thomas