Index: modules/simpletest/tests/database_test.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.test,v
retrieving revision 1.4
diff -u -p -r1.4 database_test.test
--- modules/simpletest/tests/database_test.test	15 Sep 2008 20:48:09 -0000	1.4
+++ modules/simpletest/tests/database_test.test	18 Sep 2008 21:43:32 -0000
@@ -1569,3 +1569,32 @@ class DatabaseAlter2TestCase extends Dat
     }
   }
 }
+
+/**
+ * Regression tests.
+ */
+class DatabaseRegressionTestCase extends DatabaseTestCase {
+
+  function getInfo() {
+    return array(
+      'name' => t('Regression tests'),
+      'description' => t('Regression tests cases for the database layer.'),
+      'group' => t('Database'),
+    );
+  }
+
+  /**
+   * Regression test for #310447.
+   *
+   * Tries to insert non-ascii UTF-8 data in a database column and checks
+   * if its stored properly.
+   */
+  function testRegression_310447() {
+    // That's a 255 character UTF-8 string.
+    $name = str_repeat("é", 255);
+    db_query("INSERT INTO {test} (name, age, job) VALUES (:name, 20, 'Dancer')", array(':name' => $name));
+    
+    $result = db_fetch_object(db_query("SELECT name FROM {test} WHERE name = :name", array(':name' => $name)));
+    $this->assertIdentical($name, $result->name, t("The database handles UTF-8 characters cleanly."));
+  }
+}
