php - Confusing in declaring Varchar for unicode when creating table in MYSQL? -


i want store "first name" max length of 12 characters. if exceeds, rejected.

so, create table schema

create table tb (firstname varchar(12) character set utf8 not null) 

now if name in ascii, fine. if it's in japanese or thai? each unicode char takes 3 bytes, need triple size this?

create table tb (firstname varchar(36) character set utf8 not null) 

but then, if triple size that, english users can put name longer 12 chars. how solve issue?

it's better use varchar(255) @ least when not sure field length.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -