abiieez
abiieez

Reputation: 3189

How do I insert chinese characters into MySQL from a sript?

I have the following script

set username utf8;
insert into tables values ('Active','活跃')

However after the script run, the inserted value for the chinese character is

活跃

What did I miss here ?

Upvotes: 1

Views: 1178

Answers (2)

Abdulla Nilam
Abdulla Nilam

Reputation: 38584

so that you have to change Collation to Chinese.

You can change that by here(below image)

Image

CREATE TABLE big5 (BIG5 CHAR(1) CHARACTER SET BIG5);

mysql> INSERT INTO big5 VALUES (0xf9dc);

mysql> SELECT * FROM big5;
+------+
| big5 |
+------+
| 嫺  |
+------+

MySQL Big5 Chinese character set

Read this as well

Upvotes: 1

Awais Tahir
Awais Tahir

Reputation: 178

In database,Also set collation of fields to utf8_general_ci. If you can set collation of databas and tables to utg8_general_ci as well, that will even be better.

Upvotes: 0

Related Questions