Reputation: 404
The value cut off after that character đź’€
Why this happening?
create table tmp2(t1 varchar(100));
insert into tmp2 values('befoređź’€after');
mysql> select * from tmp2;
+--------+
| t1 |
+--------+
| before |
+--------+
1 row in set (0.01 sec)
I ran followed commands and returned some useful information
mysql> SHOW FULL COLUMNS FROM tmp2;
+-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| t1 | varchar(100) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
+-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
1 row in set (0.00 sec)
and this,
mysql> SELECT character_set_name FROM information_schema.`COLUMNS` WHERE table_schema = "test" AND table_name = "tmp2" AND column_name = "t1";
+--------------------+
| character_set_name |
+--------------------+
| utf8 |
+--------------------+
1 row in set (0.00 sec)
Im testing this on ubuntu/mysql command line.
Upvotes: 3
Views: 10561
Reputation: 404
I found the solution here
I learnt some characters are not includes in utf8
There is a good article here
I needed to change column utf8 to utf8mb4 and it worked
alter table tmp2 modify t1 varchar(100) character set utf8mb4;
SET NAMES utf8mb4;
insert tmp2 values('befoređź’€after');
Upvotes: 5