Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi,

When my client writes something on a simple textarea, the special characters are automatically changed.
Example:

If my client writes:
I studied Architecture at the University of Minho, Guimarães.

The backend saves and outputs:
I studied Architecture at the University of Minho, Guimarães.

Never happened to me before. This is actually happening on ALL textarea's from the website.
Any help or suggestion on how to fix this?

Thank you!
Hi,

What is the charset encoding used by your site?
Please check your couch/config.php file and make sure it is set to 'utf-8' as follows -
Code: Select all
// 3.
// Define the charset used by your site. If in any doubt, leave the default utf-8.
define( 'K_CHARSET', 'utf-8' );
Hi,

Just checked and yes, it's exactly like that.

Maybe i've messed with textarea's config files, do you know where I can find textare's config files so I can try to replace them for the original ones? That's the only possible problem I can imagine as this never happened before on couch.
Hi,

I had a look at your site and found the following to be the problem -
while the charset of your site was indeed utf8, the charset of the database turned out to be 'latin'.
This was causing all the utf characters to be mangled up when they were saved into the database.

For the sake of documentation, since I did not have access to phpmyadmin (or other DB tool), I placed the following in one of the template -
Code: Select all
<cms:php>
    global $DB;
    $rs = $DB->raw_select( 'SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "'.$DB->database.'";' );
    echo( '<h1>'.$rs[0]['default_character_set_name'].'</h1>' );
</cms:php>

The expected output is 'utf8' but I got 'latin1'.

OK, so now that we have found the problem, to set it right you need to change the charset for all tables and the database itself to 'utf8_general_ci'.

It'd be easier for you to use phpmyadmin for doing that; one guide is this -
https://www.a2hosting.in/kb/cpanel/cpan ... phpmyadmin

Hope this helps.
Just updated the DB as you said.
It's outputing 'uft8' but characters are still showing as weird characters :-(
you need to change the charset for all tables and the database itself to 'utf8_general_ci'.

Are you sure you have also changed the charset for *all* existing tables as well? Existing tables are not affected by any later change to the db.

In any case, the problem is definitely the wrong charset. If things are not tractable, use gen_dump.php to get a database dump and reinstall the site afresh - that should reset things to normal.
6 posts Page 1 of 1