I was just wondering if it would not be a good idea to include collation/charset settings for tables during install.
From what I have noticed when setting up a new database no collation info is included for the table and in some cases the individual fields remain showing as set to the default (normally latin1_swedish_ci). Currently, I guess for reverse compatibility, setup.sql builds the tables passively according to the database default, there is no collation/charset being recorded.
Why not add this info to the CREATE TABLE query to "make sure" that the correct settings are set. I did it manually as a test and it worked great, all my tables and fields all matched with the same settings.
I am not sure what all is required to do this. I am guessing that a new collation input field will be needed in the install setup (maybe a select box would be ideal like in phpmyadnin). For reverse compatibility the mysql version can easily be checked with:
if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {...Note: this is directly from the WP db install file...but is just straight php straight from the php manual.
Anyway, just thought I would throw this into the mix since there have been so many recent post concerning charset/collation issues that maybe this would help.
To illustrate the change, added the info to the bottom of the querry (which has been reduced for illustration purposes only):
CREATE TABLE IF NOT EXISTS `site_content` (
`id` int(10) NOT NULL auto_increment,
`type` varchar(20) NOT NULL default ’document’,
`contentType` varchar(50) NOT NULL default ’text/html’,
.....
`privatemgr` tinyint(1) NOT NULL default ’0’ COMMENT ’Private manager document’,
`content_dispo` tinyint(1) NOT NULL default ’0’ COMMENT ’0-inline, 1-attachment’,
`hidemenu` tinyint(1) NOT NULL DEFAULT ’0’ COMMENT ’Hide document from menu’,
PRIMARY KEY (`id`),
KEY `id` (`id`),
KEY `parent` (`parent`),
KEY aliasidx (alias),
FULLTEXT KEY `content_ft_idx` (`pagetitle`,`description`,`content`)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci TYPE=MyISAM COMMENT=’Contains the site document tree.’;
I don’t know enough about MySQL to know what ill effects this could cause, but I can’t think of any besides the reverse compatibility issue.