Garbled characters appear when the database content is displayed on the webpage. how can this problem be solved?

Source: Internet
Author: User
Garbled characters appear when the database content is displayed on the webpage. [size = 18px] [/size] [B] Hello! The mysql character set for my phpmyadmin is utf-8unicode (utf8), and each data table is organized as utf8_general_ci; mysql connection is proofread as utf8_general_ci, and the database content is garbled when displayed on the web page
[Size = 18px] [/size] [B] Hello!

The mysql character set used by phpmyadmin is UTF-8 unicode (utf8 ),
Each data table is organized into utf8_general_ci;
Mysql connection verification: utf8_general_ci,
The language is chinese-chinese simplified,
Mysql_query ("set name 'utf8'") is also used in the program '").

Even if I did the above content, the content searched from the database still encountered garbled characters. why? [/B]

------ Solution --------------------
If the data in the database is normal, try encoding in the browser.
------ Solution --------------------
Is it a foreign server? if so, another method may be used...
------ Solution --------------------
Mysql_query ("set names 'utf8 '").
------ Solution --------------------
Good eyesight ~
Discussion
Mysql_query ("set names 'utf8 '").

------ Solution --------------------
Check that your program files are also saved in UTF-8 encoding.

If yes, please post garbled content. Be sure to use base64_encode to encode it.
------ Solution --------------------
See the format of your editor file.
------ Solution --------------------
The page also uses UTF-8
------ Solution --------------------
Define the encoding.
------ Solution --------------------
Check the 3.1 line, that is, the encoding of the database, php and html files, and set the charset of html to be consistent, you can try "view"-> encoding-> UTF8 and Chinese encoding in the browser. check the content changes on the page to see if there is a problem at that stage.
------ Solution --------------------
Discussion

Check the 3.1 line, that is, the encoding of the database, php and html files, and set the charset of html to be consistent, you can try "view"-> encoding-> UTF8 and Chinese encoding in the browser. check the content changes on the page to see if there is a problem at that stage.

------ Solution --------------------
I have encountered errors in these three places. Haha.
------ Solution --------------------
Discussion
Check that your program files are also saved in UTF-8 encoding.

If yes, please post garbled content. Be sure to use base64_encode to encode it.

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.