diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php index 6d198ea..c70603c 100644 --- a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php +++ b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php @@ -37,7 +37,9 @@ class Connection extends DatabaseConnection { protected $needsCleanup = FALSE; /** - * Flag to indicate our charset. + * The character set of this connection. + * + * Either utf8 or utf8mb4, but this could be extended to other charsets. * * @var string */ @@ -76,10 +78,8 @@ public function __construct(array $connection_options = array()) { parent::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']); - // Default Drupal to use the UTF-8 character set, but allow the use of - // utf8mb4 for better internationalization and full 4-byte UTF-8 support if - // set. Also set the collation, if a certain one has been set; otherwise, - // MySQL defaults to 'utf8_general_ci' for UTF-8. + // Apply user-defined charset for this connection if set for utf8mb4 support + // (see sites/default/default.settings.php for more on utf8mb4 support). if (isset($connection_options['charset'])) { $this->charset = $connection_options['charset']; } @@ -252,8 +252,12 @@ protected function popCommittableTransactions() { } /** - * This is used to fetch readonly charset property. - * + * Fetch the current character set for this connection. + * + * Drupal defaults to use 3-byte UTF-8 with MySQL, but as of MySQL 5.5.3 it is + * possible to use full 4-byte UTF-8 (utf8mb4). See the documentation in + * sites/default/default.settings.php on how to change this setting. + * * @return string */ public function charset() {