MySQL的“文字"中可以容纳多少UTF-8文字?场地? [英] How much UTF-8 text fits in a MySQL "Text" field?

查看:93
本文介绍了MySQL的“文字"中可以容纳多少UTF-8文字?场地?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据MySQL,text列可容纳65,535个字节.

According to MySQL, a text column holds 65,535 bytes.

因此,如果这是一个合理的边界,那么它实际上仅适合大约32k UTF-8字符,对吗?还是这是模糊的"界限之一,编写文档的人无法分辨字节中的字符,并且如果设置为utf8_general_ci之类的字符,它实际上将允许〜64k UTF-8字符?

So if this a legitimate boundary then will it actually only fit about 32k UTF-8 characters, right? Or is this one of those "fuzzy" boundaries where the guys that wrote the docs can't tell characters from bytes and it will actually allow ~64k UTF-8 characters if set to something like utf8_general_ci?

推荐答案

text列最多可包含65,535个字节.

A text column can be up to 65,535 bytes.

utf-8字符最多可以为3个字节.

An utf-8 character can be up to 3 bytes.

所以...您的实际限制可以是21,844个字符.

So... your actual limit can be 21,844 characters.

有关更多信息,请参见手册: http://dev.mysql.com/doc/refman/5.1/zh-CN/string-type-overview.html

See the manual for more info: http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html

可变长度的字符串. M代表 最大列长度,以 人物. M的范围是0到 65,535.有效最大长度 VARCHAR的最大值 行大小(65,535字节,即 在所有列之间共享)和 使用的字符集.例如utf8 字符最多需要三个 每个字符的字节数,因此为VARCHAR 使用utf8字符的列 set可以声明为最大 21,844个字符.

A variable-length string. M represents the maximum column length in characters. The range of M is 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used. For example, utf8 characters can require up to three bytes per character, so a VARCHAR column that uses the utf8 character set can be declared to be a maximum of 21,844 characters.

这篇关于MySQL的“文字"中可以容纳多少UTF-8文字?场地?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆