Current location - Quotes Website - Personality signature - Simple Chinese garbled words in PHP output
Simple Chinese garbled words in PHP output
Solution to the problem of Chinese garbled code in php

The encoding of the php file itself should match the encoding of the web page.

A. if you want to use gb23 12 encoding, then php should output header ("content-type: text/html; Charset=gb23 12 "), adding static pages.

B. If utf-8 encoding is to be used, php should output header ("content-type: text/html; Charset=utf-8 "), static page addition; Parameter selection->; File-> UTF-8 signature, select Always Delete, and then save to delete BOM information.

Php itself is not Unicode, so functions such as substr should be changed to mb_substr (mbstring extension is required); Or transcode with iconv. ?

If your HTML file is garbled, you can add UTF8 coding (internationalization coding) to the head tag: UTF-8 has no national coding, so it can be used independently of any language.

Extended data:

Other methods to solve the problem of simple Chinese garbled code in PHP output;

Add a title ("content-type: text/html; charset=gb23 12 ")

put < meta http-equiv = " Content-Type " Content = " text/html; UTF-8 in charset=UTF-8"/> was changed to gb23 12.

? References:

Baidu encyclopedia -PHP