Page 1 of 1

[SOLVED] Spurious characters in content after upgrade

Posted: Wed May 21, 2014 7:23 pm
by nlindq
I've recently upgraded from 1.6.10 with PostgreSQL all the way to 1.11.10 (with every major release step upgraded in between) on MySQL 5.1.73. PHP is version 5.3.3, all running on CentOS 6.x.

After the switch to MySQL (at the 1.10.3 upgrade step), spurious high-byte characters showed up on some of the content pages. The characters in question are nowhere in the dump / load scripts generated during the database transition, and if I perform direct queries on cms_content_props for the affected pages, the characters aren't present in the database either.

They do show up in the admin editors, either in GUI or non-GUI mode. Suspecting there might be a strange character encoding issue, I made sure the MySQL server uses utf8 as the default--the databases were created with utf8 encoding as per the install guidelines.

If I remove the spurious characters in the editor and apply the changes, they are accepted and the characters disappear from the presented pages as well, so if all else fails I can do a manual audit of every page and hope we don't miss anything.

It'd be awfully nice to find a cause, though. I've got three different sites worth of content all exhibiting the same spurious characters, so a general fix would be most welcome.

Any ideas?

Re: Spurious characters in content after upgrade

Posted: Wed May 21, 2014 7:26 pm
by calguy1000
can you post the contents of your config.php (masking out the database credentials).

Re: Spurious characters in content after upgrade

Posted: Wed May 21, 2014 9:18 pm
by nlindq
Certainly:

Code: Select all

<?php
# CMS Made Simple Configuration File
# Documentation: /doc/CMSMS_config_reference.pdf
#
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'cms_user';
$config['db_password'] = '*****';
$config['db_name'] = 'maei_cms';
$config['db_prefix'] = 'cms_';
$config['db_port'] = 0;
$config['root_url'] = 'http://www.maei.ca';
$config['timezone'] = 'America/Edmonton';
$config['default_encoding'] = 'utf-8';
?>

Re: Spurious characters in content after upgrade

Posted: Wed May 21, 2014 9:22 pm
by Jo Morg
Try commenting out $config['default_encoding'] = 'utf-8'; by prepending a # on the line:

Code: Select all

#$config['default_encoding'] = 'utf-8';
BTW, $config['root_url'] = 'http://www.maei.ca'; shouldn't be needed either.

Re: Spurious characters in content after upgrade

Posted: Wed May 21, 2014 9:27 pm
by calguy1000
There are two things that could be up:

a: The mysql import file contained the utf-8 characters, but did not create the tables and fields in utf-8 character sets

b: Character set encoding problem in communication between the mysql client and server. try setting $config['set_names'] = false; in the config.php.

Re: Spurious characters in content after upgrade

Posted: Thu May 22, 2014 5:03 pm
by nlindq
calguy1000 wrote:There are two things that could be up:

a: The mysql import file contained the utf-8 characters, but did not create the tables and fields in utf-8 character sets
My process for transitioning from Postgres to MySQL involved using the usual install process to generate the database tables, followed by a "schema-only" dump/restore, so assuming the installer does the right thing, I don't think this applies.

Also:
calguy1000 wrote: b: Character set encoding problem in communication between the mysql client and server. try setting $config['set_names'] = false; in the config.php.
That worked! After setting that configuration item and clearing the site cache, pages are now loading without spurious characters. Should that be considered a solution, or a workaround for something I missed in my setup?