KSD Posted November 11, 2014 Share Posted November 11, 2014 We just moved from a VPS to a dedicated server. There we did an update from 5.2.12 to 5.2.14 (both CENTOS 6.5 and same db release, but different provider). Now we have a problem with special characters. Most of our customers come from Germany, France, Austria and Switzerland. The old and the new MySQL db have same collation (utf8mb4_general_ci). Most static data like text for links in admin menu or static data for client are fine, but data in generated emails, access logs, etc., show up as corrupted. Example: At the database table cc_CubeCart_access one can see a column 'user_id' and its content 'Götz'. See attachment 1. But if you open CubeCart's admin to have a look on the access log there, you see 'GÄxtz'. See attachment 2. The apache works with charset UTF-8. I am not a Linux expert but it seems that PHP procedures with access to the database cause our problems. i have no clue how to solve this. Any ideas? We are already a little desperate. Tom Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 11, 2014 Share Posted November 11, 2014 There is an experiment I would like for you to try. In the two files /classes/db/mysql.class.php and mysqli.class.php, at the bottom, make these edits: mysql.class.php: Was: // Force UTF-8 @mysql_query($this->_db_connect_id, "SET NAMES 'utf8'"); // // Bug: Should be @mysql_query("SET NAMES 'utf8'", $this->_db_connect_id); @mysql_query($this->_db_connect_id, "SET CHARACTER SET 'utf8'"); // // Bug: Should be @mysql_query("SET CHARACTER SET 'utf8'", $this->_db_connect_id); Now: //Force UTF-8 //@mysql_query("SET NAMES 'utf8'", $this->_db_connect_id); //@mysql_query("SET CHARACTER SET 'utf8'", $this->_db_connect_id); @mysql_set_charset('utf8', $this->_db_connect_id); mysqli.class.php: Was: //Force UTF-8 @mysqli_query($this->_db_connect_id, "SET NAMES 'utf8'"); @mysqli_query($this->_db_connect_id, "SET CHARACTER SET 'utf8'"); Now: //Force UTF-8 //@mysqli_query($this->_db_connect_id, "SET NAMES 'utf8'"); //@mysqli_query($this->_db_connect_id, "SET CHARACTER SET 'utf8'"); @mysqli_set_charset($this->_db_connect_id, 'utf8'); According to some info I read, using the *_set_charset() function tells PHP, the database, and (most importantly) the connectoid that lets PHP talk to the database to use the specified encoding. Quote Link to comment Share on other sites More sharing options...
KSD Posted November 11, 2014 Author Share Posted November 11, 2014 I did this, but no change. Shall I reboot the system? Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 11, 2014 Share Posted November 11, 2014 I think a reboot won't make any difference. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.