From: Marcel Werk Date: Fri, 22 Jul 2016 21:44:34 +0000 (+0200) Subject: Changed mysql collaction to utf8mb4_unicode_ci X-Git-Tag: 3.0.0_Beta_1~990 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ac677ff689ad88c9bd58ce84510e75c0daa458a0;p=GitHub%2FWoltLab%2FWCF.git Changed mysql collaction to utf8mb4_unicode_ci --- diff --git a/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php b/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php index a112f073d6..82c7fa53e2 100644 --- a/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php +++ b/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php @@ -25,11 +25,11 @@ class MySQLDatabase extends Database { try { $driverOptions = [ - \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'" + \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8mb4'" ]; if (!$this->failsafeTest) { $driverOptions = [ - \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8', SESSION sql_mode = 'ANSI,ONLY_FULL_GROUP_BY,STRICT_ALL_TABLES'" + \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8mb4', SESSION sql_mode = 'ANSI,ONLY_FULL_GROUP_BY,STRICT_ALL_TABLES'" ]; } diff --git a/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php b/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php index d32e9aa13c..04e331331f 100644 --- a/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php +++ b/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php @@ -92,7 +92,7 @@ class MySQLDatabaseEditor extends DatabaseEditor { ".$columnDefinition." ".(!empty($indexDefinition) ? ',' : '')." ".$indexDefinition." - ) ENGINE=".($hasFulltextIndex ? 'MyISAM' : 'InnoDB')." DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"; + ) ENGINE=".($hasFulltextIndex ? 'MyISAM' : 'InnoDB')." DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci"; $statement = $this->dbObj->prepareStatement($sql); $statement->execute(); } diff --git a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php index f8aef0b813..908d176304 100644 --- a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php @@ -292,7 +292,6 @@ class UserOptionHandler extends OptionHandler { public function readUserInput(array &$source) { parent::readUserInput($source); - // remove 4 byte utf-8 characters (e.g. emoji) foreach ($this->rawValues as &$value) { if (is_string($value)) $value = MessageUtil::stripCrap($value); } diff --git a/wcfsetup/install/files/lib/util/MessageUtil.class.php b/wcfsetup/install/files/lib/util/MessageUtil.class.php index cb1b042f4e..dac872fcb5 100644 --- a/wcfsetup/install/files/lib/util/MessageUtil.class.php +++ b/wcfsetup/install/files/lib/util/MessageUtil.class.php @@ -31,10 +31,6 @@ class MessageUtil { // unify new lines $text = StringUtil::unifyNewlines($text); - // remove 4 byte utf-8 characters as MySQL < 5.5 does not support them - // see http://stackoverflow.com/a/16902461/782822 - $text = preg_replace('/[\xF0-\xF7].../s', '', $text); - // remove control characters $text = preg_replace('~[\x00-\x08\x0B-\x1F\x7F]~', '', $text);