Home > Backend Development > PHP Tutorial > Solution to phpMyAdmin displaying Chinese garbled characters_PHP Tutorial

Solution to phpMyAdmin displaying Chinese garbled characters_PHP Tutorial

WBOY
Release: 2016-07-13 10:56:15
Original
1652 people have browsed it

According to my experience, garbled characters in php and mysql are generally caused by document encoding problems such as gbk, uft8, gb2312, etc. that are inconsistent with the page encoding. Below I have summarized the solution to phpMyAdmin displaying Chinese garbled characters.

Look at the picture first

Solution 1

php.ini does not have extension=php_mysql.dll

After encountering this problem, it will usually appear when opening phpmyadmin

Garbled code error

We copy libmysql.dll in php to c:\windows\system32 or c:\winnt\system32

Then just restart your computer

Solution 2

The following is my modification process:
Open the libraries/select_lang.lib.php file in the root directory of phpMyAdmin;
Found:

 代码如下 复制代码
'zh-gb2312'         => array('zh|chinese simplified', 'chinese_simplified-gb2312', 'zh', '中文'),


Change it to:

 代码如下 复制代码
'zh-gb2312-utf-8'         => array('zh|chinese simplified-UTF8', 'chinese_simplified-gb2312', 'zh', '中文'),


Found again:

 代码如下 复制代码
'gb2312'       => 'gb2312',


Change it to:

 代码如下 复制代码
'gb2312'       => 'latin1',

Save the file and exit.

Then open phpMyAdmin from the browser and select Language on the homepage as: Chinese - Chinese simplified-UTF8

Then open the data table and see if the Chinese inside can be displayed normally:)


Solution Three


Tables in Mysql use latin1 encoding by default, but if the content is added through mysql commands, etc., it is generally inserted with gb2312 encoding, directly on phpmyadmin. Language: Chinese - Chinese simplified. When viewed under Chinese simplified, it is garbled

1. Open libraries/select_lang.lib.php, find the $available_languages ​​array, and add one piece of data at the end:

Php code

The code is as follows Copy code
1.'zh-gb2312-utf-8 ' => array('zh|chinese simplified latin1', 'chinese_simplified-gb2312', 'zh', '中文')
 代码如下 复制代码
1.'zh-gb2312-utf-8' => array('zh|chinese simplified latin1', 'chinese_simplified-gb2312', 'zh', '中文')  
'zh-gb2312-utf-8' => array('zh|chinese simplified latin1', 'chinese_simplified-gb2312', 'zh', '中文')
'zh-gb2312-utf-8' => array('zh|chinese simplified latin1', 'chinese_simplified-gb2312', 'zh', '中文')

Note: 中文 represents the word "Chinese".

2. Search $mysql_charset_map again to find this array, and change one of the values ​​'gb2312' => 'gb2312' to 'gb2312' => 'latin1'.

3. Re-open phpmyadmin. Language selection Chinese - Chinese simplified latin1


At this time, open the latin1 encoded table and you can see that the garbled characters are no longer there:

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632178.htmlTechArticleAccording to my experience, garbled characters in php and mysql are generally caused by document encoding problems such as gbk, uft8, gb2312, etc. It is inconsistent with the page encoding. Below I summarize the solution for phpMyAdmin to display Chinese garbled characters...
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