Home > Backend Development > PHP Tutorial > Completely solve the problem of Chinese UTF-8 garbled characters in PHPMyAdmin_PHP Tutorial

Completely solve the problem of Chinese UTF-8 garbled characters in PHPMyAdmin_PHP Tutorial

WBOY
Release: 2016-07-13 17:32:05
Original
1284 people have browsed it

php(as the current mainstream development language)MyAdmin’s Chinese garbled problem is very common and very annoying. In the past, I used php(as the current mainstream development language)MyAdmin. I recently installed it and found it very convenient. However, I also encountered the problem of garbled Chinese characters, mainly because UTF-8 and GB2312 encoding could not be used. Also displayed correctly. I found some information from the Internet, but it is not very direct. Now I will reorganize it based on my own operation.


1. Because the default encoding of MySQL(the best combination with PHP) is latin1, so first we need to modify php(as the current mainstream Development language)Encoding conversion for MyAdmin. Modify the select_lang.lib.php(as the current mainstream development language) file under the libraries directory, and change
[indent]
utf-8 => utf8,
to
utf-8 => latin1,
[/indent]


2. Next, we need to modify the encoding display of the page, changing
[indent]
zh-gb2312 => array(zh|chinese simplified, chinese_simplified-gb2312, zh),
modified to
zh-gb2312-utf-8 => array(zh|chinese simplified, chinese_simplified-gb2312, zh ),
[/indent]
That is, add -utf-8 after zh-gb2312, so that the page encoding supports UTF-8.

3. First select zh-gb2312-utf-8 to enter php (as the current mainstream development language) MyAdmin. At this time, browsing GB2312 encoded data is normal, but browsing UTF-8 The data is garbled. If you want to browse UTF-8 data, go to the homepage and select zh-utf-8 in Language.


A few notes:

1. The default language encoding is very long, you can comment out other encodings with /**/, leaving only zh -gb2312-utf-8 and zh-utf-8 two encodings.

2. Currently php (as the current mainstream development language)The latest version of MyAdmin is 2.8.0-rc1, but the language selected on the homepage of this version cannot be specific to the encoding, so it is not Recommended.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508897.htmlTechArticlephp (as the current mainstream development language) MyAdmin's Chinese garbled problem is very common and very annoying. In the past, I used PHP (as the current mainstream development language) MyAdmin. Recently, I installed...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template