Utf8_general_ci or utf8mb4 or…?

后端 未结 2 1969
时光取名叫无心
时光取名叫无心 2020-12-23 11:59

utf16 or utf32? I\'m trying to store content in a lot of languages. Some of the languages use double-wide fonts (for example, Japanese fonts are frequently twice as wide a

2条回答
  •  猫巷女王i
    2020-12-23 12:34

    MySQL's utf32 and utf8mb4 (as well as standard UTF-8) can directly store any character specified by Unicode; the former is fixed size at 4 bytes per character whereas the latter is between 1 and 4 bytes per character.

    utf8mb3 and the original utf8 can only store the first 65,536 codepoints, which will cover CJVK (Chinese, Japanese, Vietnam, Korean), and use 1 to 3 bytes per character.

    utf16 uses 2 bytes for the first 65,536 codepoints, and 4 bytes for everything else.

    As for fonts, that's strictly a visual thing.

    "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)"

    See also MySQL documentation for Unicode support.

提交回复
热议问题