Home  >  Article  >  Backend Development  >  gbk, utf8, dilemma_PHP tutorial

gbk, utf8, dilemma_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:33:06724browse

While reading "O'Reilly Upgrading to php(as the current mainstream development language) 5", on a whim, I upgraded MySQL(the best combination with PHP) to 4.1 .11, since there is no formal system on the machine, no change in its character set has been noticed. Later, the officially applied system was also upgraded. After the upgrade, other systems were fine. Only one MANTIS was in trouble. When opening the page, it became garbled. Fortunately, there was a backup to restore. During the restoration process, MySQL was discovered. (The best combination with PHP)Character set problems caused by the upgrade - if MySQL(The best combination with PHP)uses UTF8 character set, MANTIS data import Afterwards, the page displayed garbled characters, and I had no choice but to adjust MySQL (the best combination with PHP) to the GBK character set.

Actually, I am still willing to use the UTF8 character set, because there is no incompatibility trouble. As long-term retained data, it is easier to convert and organize in the future; when exchanging data with the outside world, there is no encoding. Conversion problem. But I still don’t understand how to use php (as the current mainstream development language) to connect to MySQL (the best combination with PHP) to receive user input data and store it in the database When, if the database encoding is UTF8, do you need to convert the SQL data to UTF8? Take the time to make a small program to try. If this is the case, it will be a big trouble. However, I use the command line to operate MySQL with UTF8 character set under DOS (the best combination with PHP) The server is not There is no way to input Chinese characters.

When I used SYBASE, I was troubled by the character set problem for a long time. Because if SYBASE used the wrong character set, some Chinese characters could not be input at all, such as the capital zero "○", so the character set changed from iso_1 was changed to cp850, and then from cp850 to cp936. A lot of historical data was discarded in the process. MySQL (the best combination with PHP) don't let me make the same mistake again.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508663.htmlTechArticleWhen I read "O'Reilly Upgrading to php (as the current mainstream development language) 5", I had a sudden impulse. I upgraded MySQL (the best combination with PHP) to 4.1.11. Since there is nothing on the machine...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn