php header () function is used to define the encoding of a PHP page (note: There can be no output before, otherwise error)
-
-
copy code 3, PHP or HTML file itself encoding: with EditPlus open PHP file or HTML file, save, select the encoding, if the database and page encoding is GBK, then the code here choose ANSI; If the database and page encoding is Utf-8, then Utf-8 is also selected here. The data passed in 4, JavaScript, or Flash is utf-8 encoded, and if the database and page encoding is GBK, transcoding is done and then written to the database.
-
- iconv (' utf-8 ', ' GBK ', $content);
copy code 5, in a PHP program, you can add a line to specify the code of the PHP source program: Header (' Content-type: text/html; CHARSET=GBK '); Four, coded character case difference (only in MySQL, other places are recommended uppercase UTF-8, GBK, GB2312) only in MySQL can use "utf-8" Alias "UTF8", but in other places use uppercase "UTF-8". Specifically, the command "mysql_query (set names UTF8)" is capitalized "UTF-8". The above describes the PHP set page encoding methods, as well as PHP database encoding, page encoding, encoding character case of the problem, I hope to be helpful. |