Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 4844)
+++ wp-includes/wp-db.php	(working copy)
@@ -35,6 +35,9 @@
 	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 @@
 	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 @@
 ");
 		}
 
+		if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') )
+ 			$this->query("SET NAMES '$this->charset'");
+
 		$this->select($dbname);
 	}
 
Index: wp-includes/version.php
===================================================================
--- wp-includes/version.php	(revision 4844)
+++ wp-includes/version.php	(working copy)
@@ -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 = 4772;
+$wp_db_version = 4845;
 
 ?>
Index: wp-config-sample.php
===================================================================
--- wp-config-sample.php	(revision 4844)
+++ wp-config-sample.php	(working copy)
@@ -4,6 +4,8 @@
 define('DB_USER', 'username');     // Your MySQL username
 define('DB_PASSWORD', 'password'); // ...and password
 define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
+define('DB_CHARSET', 'utf8');
+define('DB_COLLATE', 'utf8_general_ci');
 
 // You can have multiple installations in one database if you give each a unique prefix
 $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
@@ -18,4 +20,4 @@
 
 define('ABSPATH', dirname(__FILE__).'/');
 require_once(ABSPATH.'wp-settings.php');
-?>
\ No newline at end of file
+?>
Index: wp-admin/upgrade-schema.php
===================================================================
--- wp-admin/upgrade-schema.php	(revision 4844)
+++ wp-admin/upgrade-schema.php	(working copy)
@@ -1,6 +1,15 @@
 <?php
 // Here we keep the DB structure and option values
 
+$charset_collate = '';
+	
+if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
+	if ( ! empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+	if ( ! empty($wpdb->collate) )
+		$charset_collate .= " COLLATE $wpdb->collate";	
+}
+
 $wp_queries="CREATE TABLE $wpdb->categories (
   cat_ID bigint(20) NOT NULL auto_increment,
   cat_name varchar(55) NOT NULL default '',
@@ -13,7 +22,7 @@
   links_private tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (cat_ID),
   KEY category_nicename (category_nicename)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->comments (
   comment_ID bigint(20) unsigned NOT NULL auto_increment,
   comment_post_ID int(11) NOT NULL default '0',
@@ -33,14 +42,14 @@
   PRIMARY KEY  (comment_ID),
   KEY comment_approved (comment_approved),
   KEY comment_post_ID (comment_post_ID)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->link2cat (
   rel_id bigint(20) NOT NULL auto_increment,
   link_id bigint(20) NOT NULL default '0',
   category_id bigint(20) NOT NULL default '0',
   PRIMARY KEY  (rel_id),
   KEY link_id (link_id,category_id)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->links (
   link_id bigint(20) NOT NULL auto_increment,
   link_url varchar(255) NOT NULL default '',
@@ -59,7 +68,7 @@
   PRIMARY KEY  (link_id),
   KEY link_category (link_category),
   KEY link_visible (link_visible)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->options (
   option_id bigint(20) NOT NULL auto_increment,
   blog_id int(11) NOT NULL default '0',
@@ -74,14 +83,14 @@
   autoload enum('yes','no') NOT NULL default 'yes',
   PRIMARY KEY  (option_id,blog_id,option_name),
   KEY option_name (option_name)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->post2cat (
   rel_id bigint(20) NOT NULL auto_increment,
   post_id bigint(20) NOT NULL default '0',
   category_id bigint(20) NOT NULL default '0',
   PRIMARY KEY  (rel_id),
   KEY post_id (post_id,category_id)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->postmeta (
   meta_id bigint(20) NOT NULL auto_increment,
   post_id bigint(20) NOT NULL default '0',
@@ -90,7 +99,7 @@
   PRIMARY KEY  (meta_id),
   KEY post_id (post_id),
   KEY meta_key (meta_key)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->posts (
   ID bigint(20) unsigned NOT NULL auto_increment,
   post_author bigint(20) NOT NULL default '0',
@@ -119,7 +128,7 @@
   PRIMARY KEY  (ID),
   KEY post_name (post_name),
   KEY type_status_date (post_type,post_status,post_date,ID)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->users (
   ID bigint(20) unsigned NOT NULL auto_increment,
   user_login varchar(60) NOT NULL default '',
@@ -133,7 +142,7 @@
   display_name varchar(250) NOT NULL default '',
   PRIMARY KEY  (ID),
   KEY user_login_key (user_login)
-);
+) $charset_collate;
 CREATE TABLE $wpdb->usermeta (
   umeta_id bigint(20) NOT NULL auto_increment,
   user_id bigint(20) NOT NULL default '0',
@@ -142,7 +151,7 @@
   PRIMARY KEY  (umeta_id),
   KEY user_id (user_id),
   KEY meta_key (meta_key)
-);";
+) $charset_collate;";
 
 function populate_options() {
 	global $wpdb, $wp_db_version;

