PHP is displayed in the browser in Chinese is a question mark how to deal with

Source: Internet
Author: User
PHP in the browser display in Chinese is a question mark what to do?
I tried it on the Win7, and that's what happens on Mac. I suspect that there is an Apache or PHP setup problem on Mac. The source file code inside is Chinese, but the browser to see the source code when the Chinese will not be. What to do?

------Solution--------------------
That is, PHP file encoding, database (if garbled text is queried in the database) encoding is not consistent with the encoding declared in the HTML code, one of the first two is not encoded with UTF8.
------Solution--------------------
Then you look at the PHP file itself is UTF-8, and then see when the page is opened, the page encoding is selected for the corresponding UTF-8 encoding
------Solution--------------------
The PHP file will be encoded with UTF-8, are you sure?
------Solution--------------------
Explore

Reference:

Again garbled problem ...

Reference:

Garbled problem please check the following code consistency:

Encoding used by the database
Encoding used in database operations
The encoding used by the current page
Encoding of the file itself

In the same word, there will be no problem.
`

------Solution--------------------
MySQL database, php files inside, PHP itself must be one-to-the-line.

Correct settings:
Such as: All are Utf-8
MySQL database is set to UTF8 Unicode,
The PHP header is set to:
The most important point: if the PHP file itself is UTF-8 encoded, the default is ANSI.
Method: Open php file with Notepad, save as: Select Utf-8 encoding.
Ok!
  • 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.