search
HomeBackend DevelopmentPHP ProblemThe database exported by phpmyadmin is garbled

The database exported by phpmyadmin is garbled

Oct 21, 2019 pm 01:15 PM
phpmyadminGarbled charactersExport

The database exported by phpmyadmin is garbled

phpmyadmin exported database with garbled characters

The following introduces the solutions when encountering Chinese garbled characters.

The problem lies in the encoding problem. The character set encodings used by Chinese websites are generally gb2312, gbk, and utf8.

Because the default character set of phpmyadmin is latin1_swedish_ci. It is different from the commonly used gb2312, gbk, and utf8, so if the character set is not modified, garbled characters will appear.

Therefore, when exporting the database, pay attention to encoding issues. Because the commonly used character set is gbk_chinese_ci , we will take gbk_chinese_ci as an example to illustrate how to deal with the problem of Chinese garbled characters.

First of all, when exporting data, check whether the Chinese in the records in the data table can be displayed normally. If the Chinese displayed are all question marks like ??? , then you have to Reset the language to the database format of the encoding you use. For example, the encoding of the

database is gbk_chinese_ci and the database engine is MyISAM. Then the Language of phpMyAdmin must be set to Chinese simplified (zh -utf-8) instead of Chinese simplified (zh-gb2312-utf-8).

Similarly, if your data encoding is gb2312_chinese_ci, then the Language must be set to Chinese simplified (zh-gb2312-utf-8) instead of Chinese simplified (zh-utf-8).

Only if the language is selected correctly, Chinese garbled characters will not appear when we export SQL.

In order to check whether the exported sql file is correct, you can directly open the .sql file with Notepad and check the Chinese to see if it is garbled. If the display is normal, it means it was exported correctly.

When migrating the website or re-importing the sql file, the general MySQL character set: UTF-8 Unicode (utf8) does not need to be modified. When importing the above-exported sql script, select the "Character set of the file" utf8 (default) will do.

Note: Before entering any operation, such as inserting, querying, etc., the character set must be specified. The method adopted is to add a sentence to the database connection file: set names 'gbk'; will no longer appear garbled when displayed on the web page. In short, you specify which encoding you use.

At this point, the problem of Chinese garbled characters when using PHPmyadmin has been solved.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of The database exported by phpmyadmin is garbled. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor