UTF8MB4, Utf8mb4_unicode_ci, utf8mb4_general_ci in MySQL

Source: Internet
Author: User

1.utf8 and utf8mb4 (UTF8 most bytes 4)
    • UTFMB4 character encoding added after MySQL 5.5.3
    • Supports BMP (Basic multilingual Plane, basic multilingual Plane) and supplemental characters
    • Use up to four bytes of stored characters

UTF8MB4 is a superset of UTF8 and fully compatible with UTF8, capable of storing more characters in four bytes.

The standard UTF-8 character set encoding is the ability to encode 21-bit characters using 1-4 bytes, which contains almost all of the world's visible languages.
MySQL implements the UTF8 maximum use of 3 characters , contains most characters but not all. For example, emoji and some less commonly used Chinese characters, such as "Villa", these require four bytes to encode is not supported.

2. Character set, connection character set, sort character set

UTF8MB4 corresponds to a sorted character set with Utf8mb4_unicode_ci, Utf8mb4_general_ci.

Comparison of Utf8mb4_unicode_ci and Utf8mb4_general_ci:

    • Accuracy:
      • UTF8MB4_UNICODE_CI is a standard-based Unicode for sorting and comparison, allowing for precise sorting between various languages
      • Utf8mb4_general_ci does not implement Unicode collations, and in the case of certain special languages or character sets, the sort results may be inconsistent.
      • However, in most cases, the order of these special characters does not need to be so precise.
    • Performance
      • Utf8mb4_general_ci faster when comparing and sorting
      • Utf8mb4_unicode_ci in special cases, the Unicode collation implements a slightly more complex sorting algorithm in order to handle special characters.
      • But in the vast majority of cases, this kind of complex comparisons will not occur. Instead of choosing which collation, the user should be concerned that the character set and collation need to be unified in the DB.

UTF8MB4, Utf8mb4_unicode_ci, utf8mb4_general_ci in MySQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.