UTF8 turn into GBK
Using the Set names character set
Character_set_client
Character_set_result
Character_set_connection These three items are set to set names GBK in the cmd Black window, when the data file layer and the System Management layer are UTF8 in the cmd window when the data is fetched from the file through the data management layer and then arrives at Character_ Set_result there should be encoding conversion problems in this process do not turn from UTF8 to GBK? Well, if this conversion should be garbled,
Reply to discussion (solution)
Need, and your file code should be GBK.
If you have any CMD directly connected to the MySQL client operation, you don't need to, MySQL automatically converts the
If you are actually executing PHP under CMD, the output is determined by the PHP file encoding.
From the database to PHP is an IO, from PHP echo to CMD is also an IO, pay attention to the code changes before and after two IO
You say cmd, should be Windows Bar, Windows cmd By default is followed by the system encoding, such as Simplified Chinese windows its cmd default is cp936 (equivalent to GBK) encoding, this encoding can be made permanent changes through the registry, or the use of "chcp xxx" command temporarily changed , where xxx is the code number, 936 equivalent to gbk,65001 equivalent to Utf-8
At the beginning of cmd input chcp 65,001 back to the car, the cmd window becomes equivalent to the UTF-8 encoded output
Note: Cpxxx is a Microsoft-determined code, and the corresponding general-purpose encoding has a very slight difference, generally use does not involve the content of these differences, so the above is said to be "equivalent"
Upstairs to learn a silent collection
As long as your data field's connection proofing is in the Chinese series (GBK, Big5, UTF8, ucs-2, utf-16 ...)
Then you only need to set the names character set when you use it, and then you can do it in the character set you want.
The code conversion work is done by MySQL for you