diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc
index 0b84f27..9c952f3 100644
--- a/includes/database/mysql/database.inc
+++ b/includes/database/mysql/database.inc
@@ -25,6 +25,8 @@ class DatabaseConnection_mysql extends DatabaseConnection {
 
     // MySQL never supports transactional DDL.
     $this->transactionalDDLSupport = FALSE;
+    // Allow the drupal default charset to be overridden in the settings.php.
+    $charset = (isset($connection_options['charset']) ? $connection_options['charset'] : 'utf8');
 
     $this->connectionOptions = $connection_options;
 
@@ -39,7 +41,7 @@ class DatabaseConnection_mysql extends DatabaseConnection {
     // Character set is added to dsn to ensure PDO uses the proper character
     // set when escaping. This has security implications. See
     // https://www.drupal.org/node/1201452 for further discussion.
-    $dsn .= ';charset=utf8';
+    $dsn .= ';charset=' . $charset;
     $dsn .= ';dbname=' . $connection_options['database'];
     // Allow PDO options to be overridden.
     $connection_options += array(
@@ -58,10 +60,10 @@ class DatabaseConnection_mysql extends DatabaseConnection {
     // 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']);
+      $this->exec('SET NAMES ' . $charset . ' COLLATE ' . $connection_options['collation']);
     }
     else {
-      $this->exec('SET NAMES utf8');
+      $this->exec('SET NAMES ' . $charset);
     }
 
     // Set MySQL init_commands if not already defined.  Default Drupal's MySQL
diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc
index 2a2722e..d3120a5 100644
--- a/includes/database/mysql/schema.inc
+++ b/includes/database/mysql/schema.inc
@@ -81,7 +81,8 @@ class DatabaseSchema_mysql extends DatabaseSchema {
     // Provide defaults if needed.
     $table += array(
       'mysql_engine' => 'InnoDB',
-      'mysql_character_set' => 'utf8',
+      // Allow charset to be overridden in settings.php.
+      'mysql_character_set' => (isset($info['charset']) ? $info['charset'] : 'utf8'),
     );
 
     $sql = "CREATE TABLE {" . $name . "} (\n";
@@ -130,7 +131,14 @@ class DatabaseSchema_mysql extends DatabaseSchema {
    */
   protected function createFieldSql($name, $spec) {
     $sql = "`" . $name . "` " . $spec['mysql_type'];
-
+    $info = $this->connection->getConnectionOptions();
+    if (isset($spec['length']) && isset($info['charset'])) {
+      // If the length of the field is set and the collation is utf8mb4
+      // length should be 191 and not 255.
+      if ($spec['length'] >= 192 && $info['charset'] == "utf8mb4") {
+        $spec['length'] = 191;
+      }
+    }
     if (in_array($spec['mysql_type'], array('VARCHAR', 'CHAR', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'TEXT'))) {
       if (isset($spec['length'])) {
         $sql .= '(' . $spec['length'] . ')';
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index 562f998..c4b02c5 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -126,6 +126,21 @@
  * );
  * @endcode
  *
+ * For handling proper UTF8 including emojis, asian symbols, mathematical
+ * symbols, you may use the collation and charset to utf8mb4:
+ * @code
+ * $databases['default']['default'] = array(
+ *   'driver' => 'mysql',
+ *   'database' => 'databasename',
+ *   'username' => 'username',
+ *   'password' => 'password',
+ *   'host' => 'localhost',
+ *   'prefix' => 'main_',
+ *   'collation' => 'utf8mb4_general_ci',
+ *   'charset' => 'utf8mb4',
+ * );
+ * @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
  * name will be prepended with its value. Be sure to use valid database
