对于一些人来说,排序规则utf8mb4_unicode_520_ci
看起来很奇怪,但WordPress尽可能使用这种排序规则。其他排序规则次之。
请注意此行:
//\\u unicode\\u 520\\u是一种更好的排序规则,我们应该在可用时使用它。
一些插件将创建utf8mb4_unicode_520_ci
排序规则表。
File: /var/www/html/test100.com/wp-includes/wp-db.php
761: /**
762: * Determines the best charset and collation to use given a charset and collation.
763: *
764: * For example, when able, utf8mb4 should be used instead of utf8.
765: *
766: * @since 4.6.0
767: * @access public
768: *
769: * @param string $charset The character set to check.
770: * @param string $collate The collation to check.
771: * @return array The most appropriate character set and collation to use.
772: */
773: public function determine_charset( $charset, $collate ) {
774: if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) {
775: return compact( \'charset\', \'collate\' );
776: }
777:
778: if ( \'utf8\' === $charset && $this->has_cap( \'utf8mb4\' ) ) {
779: $charset = \'utf8mb4\';
780: }
781:
782: if ( \'utf8mb4\' === $charset && ! $this->has_cap( \'utf8mb4\' ) ) {
783: $charset = \'utf8\';
784: $collate = str_replace( \'utf8mb4_\', \'utf8_\', $collate );
785: }
786:
787: if ( \'utf8mb4\' === $charset ) {
788: // _general_ is outdated, so we can upgrade it to _unicode_, instead.
789: if ( ! $collate || \'utf8_general_ci\' === $collate ) {
790: $collate = \'utf8mb4_unicode_ci\';
791: } else {
792: $collate = str_replace( \'utf8_\', \'utf8mb4_\', $collate );
793: }
794: }
795:
796: // _unicode_520_ is a better collation, we should use that when it\'s available.
797: if ( $this->has_cap( \'utf8mb4_520\' ) && \'utf8mb4_unicode_ci\' === $collate ) {
798: $collate = \'utf8mb4_unicode_520_ci\';
799: }
800:
801: return compact( \'charset\', \'collate\' );
802: }
The
utf8mb4_unicode_520_ci
(Unicode排序算法5.2.0,2010年10月)排序是对
utf8mb4_unicode_ci
(UCA 4.0.02003年11月)。
MySQL何时支持以后的UCA还没有消息。
The very latest UCA is 9.0.0 http://www.unicode.org/reports/tr10/, 但MySQL不支持这一点。