Back to Blog
PHP Development

Better Unicode Support in MySQL 5.5 UTF8MB4

Beginning with version 5.5 of MySQL , utf8mb4 character set was introduced, in order to better support Unicode. Further reading: MySQL and Unicode , also directly related to PHP Sample dk.sql file, part of DotKernel framework, was updated in revision 793 Only one downside , is not possible to use anymore VARCHAR(255), as you will get the error:
>#1071 - Specified key was too long; max key length is 767 bytes
Explanation here ; so we use instead VARCHAR(150) Now we should change the connection charset. In config/application.ini file, edit the below line :
>database.params.charset = utf8mb4
Other changes that can be made in my.cnf file are all related to replacing the string utf8_* with utf8mb4_*
>character_set_server=utf8mb4
>collation_server=utf8mb4_general_ci
>collation_server=utf8mb4_unicode_ci