First cut at mysql utf-8 charset suport. Props to sehh, drupal, and textpattern. fixes #3517

git-svn-id: http://svn.automattic.com/wordpress/trunk@4860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2007-02-02 00:04:35 +00:00
parent af10b7443f
commit ce0f8b4a66
4 changed files with 35 additions and 12 deletions

View File

@@ -3,6 +3,6 @@
// This holds the version number in a separate file so we can bump it without cluttering the SVN
$wp_version = '2.2-bleeding';
$wp_db_version = 4859;
$wp_db_version = 4860;
?>

View File

@@ -35,6 +35,9 @@ class wpdb {
var $optiongroup_options;
var $postmeta;
var $charset;
var $collate;
/**
* Connects to the database server and selects a database
* @param string $dbuser
@@ -49,6 +52,12 @@ class wpdb {
function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
register_shutdown_function(array(&$this, "__destruct"));
if ( defined('DB_CHARSET') )
$this->charset = DB_CHARSET;
if ( defined('DB_COLLATE') )
$this->collate = DB_COLLATE;
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
if (!$this->dbh) {
$this->bail("
@@ -63,6 +72,9 @@ class wpdb {
");
}
if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') )
$this->query("SET NAMES '$this->charset'");
$this->select($dbname);
}