Modifies the default encoding.
This code really messed up.
When the database server was installed, no database encoding was selected. Querying database encoding
PHP Code
Show create database guest;
All of them are latin1. Search the next Google,
There are a few questions,
Can 1:default-character-set=gb2312 change the overall situation? (That is, modify the database server default character set)
2: The default has been latin1, the creation of the database did not specify the encoding, this time should also be Latin it?
PHP connection to the database this part, if I specify the encoding, this time is OK?
PHP Code
mysql_query (set names gb2312)
It seems to be written like this, novice don't blame.
------Solution--------------------
Default-character-set in My.ini is the default character set for MySQL
Need to restart MySQL if modified
If you modify, you need to take into account the needs of other users!
If not modified, the character set is not involved in all MySQL applications. This will return to the origin of the database.
In fact, MySQL introduced the concept of character sets, but there is no subsequent action. For example, full-text search is still not available
------Solution--------------------
When you create a database, you set the encoding you need, such as UTF8 GBK
PHP operation database when the execution
mysql_query ("Setnames utf8"); or Setnames GBK.
The output page specifies the appropriate encoding when the data set is obtained
Header ("content-type:text/html; Charset=utf-8 "); or GBK
If it is utf-8 file encoding remember to also save the appropriate encoding
Such...
///////////////////////////////////
Export your data, re-set the database encoding and then import the data and then refer to the above method operation should be OK.