Login!
Lost password?
 

MODx Bug/Feature Tracker and Feature Requests

Welcome to the MODx CMS Tracker. Please choose the appropriate project from the drop down menu and provide as much information as possible regarding your server environment and browser. Thanks!

FS#244 — Wrong character set interpretation during storing to the database

Attached to Project — MODx
Opened by Robert Zelnik (rzelnik) - Wednesday, 01 February 2006, 02:38PM
Last edited by Jason Coward (opengeek) - Friday, 12 January 2007, 02:09PM
Task Type Bug Report
Category Core Distribution
Status Closed
Assigned To Jason Coward (opengeek)
Garry Nutting (garryn)
Operating System All
Severity High
Priority High
Reported Version 0.9.1
Due in Version 0.9.6
Due Date Undecided
Percent Complete 100%

Details

I would like to create a site on MODx in UTF-8 charset, but some non-ascii characters are scrambled. I cannot store correctly these characters used in Slovak language: ľščťžýáíéóú.

I have found some hack that not solve the problem, but maybe it will help to find it.
I tried this:
1. I set up a correct utf8 collation in MySQL for modx_site_content table (utf8_slovak_ci - may be also utf8_general_ci or any other utf8_*, it doesn't matter)
2. I set System configuration > character encoding to Unicode-UTF8
3. I replaced a "iso-8859-1" by "[(etomite_charset)]" in the site template
4. I inserted this line:
mysql_query("SET CHARACTER SET utf8");
on line 63 - after "$this->isConnected = true;"
in the manager/includes/extenders/dbapi.mysql.class.inc.php
5. I edited the text in modx_site_content directly in phpMyAdmin

With this hack the text corectly inserted via phpMyAdmin is displayed correctly on the frontend, but in manager it is still scrambled. When I edit it via backend manager, it is stored to the database scrambled and the frontend show it scrambled the same way as it is in the database. So IMHO the problem is a wrong character set interpretation in both ways (MODx to MySQL and MySQL to MODx).

I use
MODx 0.9.1 rev 646
PHP Version 5.0.2
Mozilla Firefox 1.0.7
MySQL 4.1.5-gamma (collation set to utf8_slovak_ci)
Mandrakelinux 10.1
This task depends upon

This task blocks these from closing
Closed by  Ryan Thrash (rthrash)
Saturday, 14 April 2007, 09:27AM
Reason for closing:  Fixed
Comment by Nurzhan Kirbassov (km_sameboy) - Tuesday, 14 February 2006, 12:12PM
I am having a problem that is somewhat alike. I can see the russian (kazakh) text, except for the "с" letter, which is replaced by "??".

I am using MODx 0.9.2
PHP 5.0.4
MySQL 4.1.12a , collation utf8_general_ci
Windows

Comment by Michal Till (tillda) - Thursday, 22 June 2006, 09:42AM
Yes this is a problem, one of a high priority and severity

Comment by Roel Titulaer (Roel) - Thursday, 27 July 2006, 05:38AM
To fix the UTF-8 encoding problem on the backend you will also need to add one line:
mysql_query("SET CHARACTER SET utf8");
after: mysql_select_db($dbase);
in: manager/index.php


Comment by Ryan Thrash (rthrash) - Thursday, 04 January 2007, 09:20AM
Jason can this be closed out due to your recent commit for 0951

Comment by Jason Coward (opengeek) - Friday, 12 January 2007, 02:09PM
  • Field changed: Status (Assigned → Duplicate)
  • Field changed: Due in Version (0.9.5 → 0.9.6)
  • Field changed: Percent Complete (0% → 100%)
This is addressed in a related bug report.