Unicode UTF-8 Problems Unicode UTF-8 Problems
 

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

Unicode UTF-8 Problems

Started by KchoPrro, August 07, 2022, 01:46:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

KchoPrro

Hello friends, I have changed the server and I have solved a problem that I had with the php version of the server (I had to go down to 5.6). Now my website is working again but I have a UTF-8 encoding problem (before the change of the server it did not happen to me).

In some parts of Coppermine the characters do not come out correctly, an examples;

Word that should come out: Fotografía, Orquídeas, Rincón, Álbum
Word that comes out: Fotografía, Orquídeas, Rincón, álbum

I have checked with the Coppermine php files because the html of the index does not have this problem, but neither do some files that I have uploaded, for example:
https://www.adolfoventas.es/galeria/perfil.php

It also doesn't happen on any of the pages created with minicms.

What could be happening? I could change all the words, one at a time, but it's a very big job.

Thank you very much!

ron4mac

It's a database coding issue.
Try adding:
$CONFIG['dbcharset'] = 'utf8';
to your include/config.inc.php file.

KchoPrro

Ooohhh!, I think the problem has not been solved  :'( :'(. I have left it like this, I think it is correct, but the web continues to show some characters wrong  ::) :

<?php
// Coppermine configuration file

// MySQL configuration
$CONFIG['dbserver'] = '*******';        // Your databaseserver
$CONFIG['dbuser'] ='*********';        // Your mysql username
$CONFIG['dbpass'] = '********';        // Your mysql password
$CONFIG['dbname'] = '********';       // Your mysql database name
$CONFIG['dbcharset'] = 'utf8';             // Force Database to UNICODE UTF-8

// MySQL TABLE NAMES PREFIX
$CONFIG['TABLE_PREFIX'] =                '';
?>


The funny thing is that only some characters go wrong, other characters, which should also go wrong, go right.

Thanks for helping  :-*

ron4mac

You might try removing the dbcharset value then (put // at the beginning of that line).

Only strings that are coming from the database are effected. The ones that you point out that are okay come from the language file(s), not from the database.

KchoPrro

Quote from: ron4mac on August 12, 2022, 03:18:53 PM
You might try removing the dbcharset value then (put // at the beginning of that line).

Only strings that are coming from the database are effected. The ones that you point out that are okay come from the language file(s), not from the database.

Done. I have left it as it was before. There is no solution? If I update to CPG 1.6x, could the problem be solved?

KchoPrro

Quote from: KchoPrro on August 13, 2022, 06:52:41 PM
Done. I have left it as it was before. There is no solution? If I update to CPG 1.6x, could the problem be solved?

I answer to myself;

Updating CPG from 1.5.48 to 1.6.19 has not solved the problem, I keep getting weird characters in some words. I also see these characters in the database.

Finally, I believe that there is no other solution than to correct every word in the entire gallery  :'( :'(.

ron4mac

I'm sorry I can't give you exact detail but others have solved this without having to do what you suggest. If you search the forum well enough, you may find some tips for dealing with your situation. I think by using the right combination of dbcharset in the config file and table encoding values in the database, your problem could be solved.

KchoPrro

Quote from: ron4mac on August 16, 2022, 01:33:58 PM
I'm sorry I can't give you exact detail but others have solved this without having to do what you suggest. If you search the forum well enough, you may find some tips for dealing with your situation. I think by using the right combination of dbcharset in the config file and table encoding values in the database, your problem could be solved.

Thanks again ron4mac, you are always on the other side to help users :)

I will search better. I am now on CPG version 1.6.19 and the problem still exists. I don't have any experience in computer programming but I see that the errors also appear in the database (Screenshot attached).

I believe that CPG correctly shows what appears in the Database, it is not CPG's fault. It is possible that when making a backup copy of CPG in my previous hosting this problem appeared and the database has already been left wrong. If it were related, I'm afraid I no longer have access to the previous hosting.

Well, if I don't find a faster solution, I'll have no choice but to make the corrections directly in the database, with a lot of time (it's almost 1,000 entries).

ron4mac

You should try:
$CONFIG['dbcharset'] = 'latin1';
in your include/config.inc.php file.

KchoPrro

Quote from: ron4mac on August 22, 2022, 01:35:23 PM
You should try:
$CONFIG['dbcharset'] = 'latin1';
in your include/config.inc.php file.

This does work! :)
My website is displayed correctly now, despite that, in the Database there are the strange characters (I attach two screenshots).

Logically, now what goes wrong are the words that I manually corrected, so it's not that they are wrong in the database, I suspect that they have to be like that and then the browsers must interpret those characters in Unicode UTF-8. For some reason this doesn't work, but latin1 does solve it.

Now I only have to undo the first 25 entries that I modified in the database manually.

Thanks a lot again ron4mac ;)