Mysql c garbled solution: 1. Find the my.cnf file and edit it to add "default-character-set=utf8"; 2. Add "mysql_set_character_set(&db,"utf8″);" to the program statement.
The operating environment of this article: Windows7 system, mysql5.5, DELL G3 computer
How to solve the problem of mysql c garbled characters?
C reading mysql produces garbled characters problem
When writing the interface API, I found that the Chinese characters utf8 input were read using c under Linux and displayed as "? ?" question mark, this is due to encoding.
It’s very simple to make changes in two places and it’s done.
1. First find the mysql my.cnf configuration file /etc/my.cnf, edit and add
[mysqld] default-character-set=utf8
2. Add the mysql_set_character_set(&db,”utf8″); statement in the program
Recommended learning: "mysql video tutorial"
The above is the detailed content of How to solve the problem of mysql c garbled characters. For more information, please follow other related articles on the PHP Chinese website!