utf8_general_ci 或 utf8mb4 还是...? [英] Utf8_general_ci or utf8mb4 or...?
问题描述
utf16 还是 utf32?我正在尝试以多种语言存储内容.一些语言使用双宽字体(例如,日文字体通常是英文字体的两倍).我不确定我应该使用哪种数据库.有关这四个字符集之间差异的任何信息...
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 as English fonts). I'm not sure which kind of database I should be using. Any information about the differences between these four charsets...
推荐答案
MySQL的utf32
和utf8mb4
(以及标准的UTF-8)可以直接存储指定的任意字符通过 Unicode;前者的大小固定为每个字符 4 个字节,而后者的大小在每个字符 1 到 4 个字节之间.
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
和原来的utf8
只能存储前65536个码位,会覆盖CJVK(中文、日文、越南、韩文),使用1到3个字节每个字符.
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
前 65,536 个代码点使用 2 个字节,其他所有代码点使用 4 个字节.
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.
"每个软件开发人员绝对、肯定必须了解 Unicode 和字符集的绝对最低要求(没有任何借口)!)"
另请参阅 有关 Unicode 支持的 MySQL 文档.
这篇关于utf8_general_ci 或 utf8mb4 还是...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!