diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 216c9cf027..920b7f9484 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -84,9 +84,19 @@ class wpdb { $this->ready = true; - if ( !empty($this->charset) && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') ) - $this->query("SET NAMES '$this->charset'"); - + if ( $this->supports_collation() ) { + $collation_query = ''; + if ( !empty($this->charset) ) { + $collation_query = "SET NAMES '{$this->charset}'"; + if (!empty($this->collate) ) + $collation_query .= " COLLATE '{$this->collate}'"; + } + + if ( !empty($collation_query) ) + $this->query($collation_query); + + } + $this->select($dbname); }