Baterka
Baterka

Reputation: 3714

Is `utf8` in MariaDB still `utf8mb3`?

From MySQL 8 is utf8 charset really 4byte utf8mb4 and not 3byte utf8mb3, but what about MariaDB?

Does MariaDB got the same update in some version?

Is it safe to use utf8 when we need to save characters like emojis nowadays with latest MariaDB/MySQL servers?

Upvotes: 2

Views: 5777

Answers (2)

C0rn3j
C0rn3j

Reputation: 429

The proper way to do this is to be specific to not cause confusion, use either utf8mb3(deprecated in MySQL and also slower there) or utf8mb4.

MariaDB as per: https://mariadb.com/kb/en/unicode/

  • 10.6 and later: utf8 is aliased to utf8mb4, but UTF8_IS_UTF8MB3 is enabled by default through old_mode, making utf8 still resolve to utf8mb3.
    utf8 will become utf8mb4 in the future as default old_mode flags are automatically deprecated.

  • 10.5 and earlier: utf8 is aliased to utf8mb3, and only utf8mb4 is actual UTF-8.

MySQL as per https://dev.mysql.com/doc/refman/8.0/en/charset-unicode.html

  • 8.0 and later: utf8 is aliased to utf8mb3, and only utf8mb4 is actual UTF-8.
    utf8mb3 is now deprecated and slated for complete removal, with utf8 becoming utf8mb4 in the future.

  • 5.7 and earlier: utf8 is aliased to utf8mb3, and only utf8mb4 is actual UTF-8.

Upvotes: 3

deceze
deceze

Reputation: 522451

utf8 is still utf8mb3, and only utf8mb4 is actual UTF-8. See the documentation:

This is unlikely to ever change, since it breaks the behaviour of existing code.

Upvotes: 6

Related Questions