Home >Backend Development >PHP Tutorial >mysql中的设置varchar长度问题

mysql中的设置varchar长度问题

WBOY
WBOYOriginal
2016-06-23 13:48:401146browse

utf-8编码格式,如果某个字段设置为varchar(10),是不是只能存放5个中文?
要是表单接收10个中文,系统是截取前5个中文保存,还是全部保存?还是出错?


回复讨论(解决方案)

测试结果:utf8下字段为varchar(10),存放了10个中文,超出部分截掉,只留前10个字符

字符数和字节数不是一个概念
varchar(10) 值得是可存放 10 个字符

varchar(10)  
意思是可以放10个字符,包括中文

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn