Index: includes/database/mysql/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/mysql/database.inc,v
retrieving revision 1.31
diff -u -p -r1.31 database.inc
--- includes/database/mysql/database.inc	30 Jun 2010 16:55:49 -0000	1.31
+++ includes/database/mysql/database.inc	20 Jul 2010 16:51:31 -0000
@@ -47,8 +47,15 @@ class DatabaseConnection_mysql extends D
       PDO::ATTR_CASE => PDO::CASE_LOWER,
     ));
 
-    // Force MySQL to use the UTF-8 character set by default.
-    $this->exec('SET NAMES "utf8"');
+    // Force MySQL to use the UTF-8 character set. Also set the collation, if a
+    // certain one has been set; otherwise, MySQL defaults to 'utf8_general_ci'
+    // for UTF-8.
+    if (!empty($connection_options['collation'])) {
+      $this->exec('SET NAMES utf8 COLLATE ' . $connection_options['collation']);
+    }
+    else {
+      $this->exec('SET NAMES utf8');
+    }
 
     // Force MySQL's behavior to conform more closely to SQL standards.
     // This allows Drupal to run almost seamlessly on many different
Index: includes/database/mysql/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/mysql/schema.inc,v
retrieving revision 1.38
diff -u -p -r1.38 schema.inc
--- includes/database/mysql/schema.inc	28 Jun 2010 19:57:34 -0000	1.38
+++ includes/database/mysql/schema.inc	20 Jul 2010 16:56:34 -0000
@@ -74,10 +74,12 @@ class DatabaseSchema_mysql extends Datab
    *   An array of SQL statements to create the table.
    */
   protected function createTableSql($name, $table) {
-    // Provide some defaults if needed
+    $info = $this->connection->getConnectionOptions();
+
+    // Provide defaults if needed.
     $table += array(
       'mysql_engine' => 'InnoDB',
-      'mysql_character_set' => 'UTF8',
+      'mysql_character_set' => 'utf8',
     );
 
     $sql = "CREATE TABLE {" . $name . "} (\n";
@@ -97,6 +99,13 @@ class DatabaseSchema_mysql extends Datab
     $sql = substr($sql, 0, -3) . "\n) ";
 
     $sql .= 'ENGINE = ' . $table['mysql_engine'] . ' DEFAULT CHARACTER SET ' . $table['mysql_character_set'];
+    // By default, MySQL uses the default collation for new tables, which is
+    // 'utf8_general_ci' for utf8. If an alternate collation has been set, it
+    // needs to be explicitly specified.
+    // @see DatabaseConnection_mysql
+    if (!empty($info['collation'])) {
+      $sql .= ' COLLATE ' . $info['collation'];
+    }
 
     // Add table comment.
     if (!empty($table['description'])) {
Index: sites/default/default.settings.php
===================================================================
RCS file: /cvs/drupal/drupal/sites/default/default.settings.php,v
retrieving revision 1.48
diff -u -p -r1.48 default.settings.php
--- sites/default/default.settings.php	28 Jun 2010 19:57:34 -0000	1.48
+++ sites/default/default.settings.php	20 Jul 2010 16:46:11 -0000
@@ -53,7 +53,7 @@
  *
  * Each database connection is specified as an array of settings,
  * similar to the following:
- *
+ * @code
  * array(
  *   'driver' => 'mysql',
  *   'database' => 'databasename',
@@ -62,7 +62,9 @@
  *   'host' => 'localhost',
  *   'port' => 3306,
  *   'prefix' => 'myprefix_',
+ *   'collation' => 'utf8_general_ci',
  * );
+ * @endcode
  *
  * The "driver" property indicates what Drupal database driver the
  * connection should use.  This is usually the same as the name of the
@@ -86,11 +88,12 @@
  * fall back to the single master server.
  *
  * The general format for the $databases array is as follows:
- *
+ * @code
  * $databases['default']['default'] = $info_array;
  * $databases['default']['slave'][] = $info_array;
  * $databases['default']['slave'][] = $info_array;
  * $databases['extra']['default'] = $info_array;
+ * @endcode
  *
  * In the above example, $info_array is an array of settings described above.
  * The first line sets a "default" database that has one master database
@@ -100,7 +103,7 @@
  * "extra".
  *
  * For a single database configuration, the following is sufficient:
- *
+ * @code
  * $databases['default']['default'] = array(
  *   'driver' => 'mysql',
  *   'database' => 'databasename',
@@ -108,7 +111,9 @@
  *   'password' => 'password',
  *   'host' => 'localhost',
  *   'prefix' => 'main_',
+ *   'collation' => 'utf8_general_ci',
  * );
+ * @endcode
  *
  * You can optionally set prefixes for some or all database table names
  * by using the 'prefix' setting. If a prefix is specified, the table
@@ -117,14 +122,14 @@
  * are desired, leave it as an empty string ''.
  *
  * To have all database names prefixed, set 'prefix' as a string:
- *
+ * @code
  *   'prefix' => 'main_',
- *
+ * @endcode
  * To provide prefixes for specific tables, set 'prefix' as an array.
  * The array's keys are the table names and the values are the prefixes.
  * The 'default' element is mandatory and holds the prefix for any tables
  * not specified elsewhere in the array. Example:
- *
+ * @code
  *   'prefix' => array(
  *     'default'   => 'main_',
  *     'users'     => 'shared_',
@@ -132,13 +137,13 @@
  *     'role'      => 'shared_',
  *     'authmap'   => 'shared_',
  *   ),
- *
+ * @endcode
  * You can also use a reference to a schema/database as a prefix. This maybe
  * useful if your Drupal installation exists in a schema that is not the default
  * or you want to access several databases from the same code base at the same
  * time.
  * Example:
- *
+ * @code
  *   'prefix' => array(
  *     'default'   => 'main.',
  *     'users'     => 'shared.',
@@ -146,10 +151,11 @@
  *     'role'      => 'shared.',
  *     'authmap'   => 'shared.',
  *   );
- *
+ * @endcode
  * NOTE: MySQL and SQLite's definition of a schema is a database.
  *
  * Database configuration format:
+ * @code
  *   $databases['default']['default'] = array(
  *     'driver' => 'mysql',
  *     'database' => 'databasename',
@@ -170,6 +176,7 @@
  *     'driver' => 'sqlite',
  *     'database' => '/path/to/databasefilename',
  *   );
+ * @endcode
  */
 $databases = array();
 
