Skip to content

Instantly share code, notes, and snippets.

@jht5945
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jht5945/52e4df5770025c40e7b7 to your computer and use it in GitHub Desktop.
Save jht5945/52e4df5770025c40e7b7 to your computer and use it in GitHub Desktop.
utf8mb4
// refer:
// http://zh.wikibooks.org/wiki/Unicode/20000-20FFF
// http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
// https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-upgrading.html
mysql> create table test_x (value varchar(100)) default character set utf8mb4;
Query OK, 0 rows affected (0.04 sec)
mysql> insert into test_x values('𠀳');
Query OK, 1 rows affected, 1 warnings (0.01 sec)
mysql> select length(value),char_length(value) from test_x;
+---------------+--------------------+
| length(value) | char_length(value) |
+---------------+--------------------+
| 4 | 4 |
+---------------+--------------------+
1 rows in set (0.01 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment