Saturday, August 20, 2011

MODx Revolution and UTF8

If you ever need to insert in latin symbol or unicode into modx title or content...
Modify modx_site_content fields:
+ pagetitle, longtitle, description, introtext, content
to unicode_general_ci encoding.
(Note: This is a fulltext index, so you will have to execute 1 statement to alter all 5 fields)
And also modify template variable content:
ALTER TABLE  `modx_site_tmplvar_contentvalues` CHANGE  `value`  `value` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL

Next, modify core/config/config.inc.php and change the line:
+ $database_connection_charset = 'utf8';
+ $database_dsn = 'mysql:host=...;dbname=...;charset=utf8';

And you may start testing it it works :)
In my setup, its somehow in njis charset... (im not sure why)

No comments: