Database--garbled display in table

Source: Internet
Author: User

CREATE table with Navicat for MySQL, insert Chinese garbled
section has encoding settings.
garbled, it must be the code you're using to mess it up.

Workaround:

The first step is to change the database code first

first modify your database, if your page with UTF-8 encoding then your database encoding needs to be set to UTF-8, each field needs to be set. To maintain consistency inside and outside, you can use the Navicat for MySQL tool, this tool can be seen very clear, if the table \ A lot of fields, you can export SQL statements, and then replace the corresponding code in SQL statements such as gb2312 Replace with UTF8, and then re-create a library, the creation of the character set selection UTF8 the SQL statement import, check that all the code is UTF8 OK

Second Step program modification

when 1\ read the library,
mysql_query ("Set names UTF8");
2\ each page header with a sentence
header ("content-type:text/html; Charset=utf-8 ");
3\ Check that all encoding declarations are correct
<meta http-equiv= "Content-type" content= "text/html; charset=utf-8" >
4\ Check the page of the existing text used by the correct encoding, it is recommended that you use EditPlus in the lower right corner of the display UTF-8 or ANSI, to ensure that all the files with Chinese open after the display of the encoding set is UTF-8, if not, you can open all the files and choose from the menu " Document "-" File Encoding "-" file Encoding (multiple files) ", then select all the file point OK, change the encoding to UTF-8 OK!

OK to this position is done, all the code is consistent, absolutely no longer garbled, say a word. For the choice of MySQL operation tool I only recommend two, one is familiar with phpMyAdmin and then navicat for MySQL also have a lot of people are in use.

Database--garbled display in table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.