PHP output Chinese page when there is a Chinese garbled solution

Source: Internet
Author: User
PHP Chinese garbled problem in PHP can be said to appear frequently, yesterday in the local environment to create a file, file encoding is UTF-8 format, printing a simple statement on the appearance of Chinese garbled, tossing a long time, only to find the reason. Here's how to solve this problem and document the solution here.

Garbled problem:

Yesterday wrote a very simple PHP output Chinese page, but there is garbled problem, the first reaction may be the script file encoding format has a problem, looked under, no problem, the original file code for Utf-8, what is the reason?

This problem first encountered, although the output page can be added <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>, can be temporarily resolved, but this method does not solve the problem, from the fundamental solution, and later on the Internet, the original is php.ini configuration of the default character set problem.

Workaround:

Open a. php.ini file, find;d efault_charset = "Iso-8859-1", instead: Default_charset = "UTF-8" Remove the preceding semicolon (remove the comment), change the character set to UTF-8, restart the Apache service, Refresh the page, Chinese display is normal.

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.