Php sets the encoding format. A. if you want to use gb2312 encoding, php needs to output the header ("Content-Type: texthtml; charsetgb2312), add metahttp-equivContent-Typecontenttexthtml to the static page, and. if you want to use gb2312 encoding, php needs to output the header ("Content-Type: text/html; charset = gb2312") and add it to the static page. The encoding format of all files is ANSI, which can be opened in Notepad. save it as ANSI and overwrite the source file.
B. If you want to use UTF-8 encoding, php needs to output headers: header ("Content-Type: text/html; charset = utf-8") and add static pages The encoding format of all files is UTF-8.
Recently, I need to use the iconv function to convert the captured UTF-8 encoded page to gb2312. I found that only the iconv function can be used to convert the captured data into less data for no reason. I was depressed for a while. I checked the information on the Internet to find out that this is a bug in the iconv function. Iconv fails to convert the character "-" to gb2312. The solution is simple, that is, after adding "// IGNORE" after the code to be converted, that is, the second parameter of the iconv function, as follows:
Iconv ("UTF-8", "GB2312 // IGNORE", $ data)
Ignore indicates that the conversion error is ignored. without the ignore parameter, all strings after this character cannot be saved.
Http://www.bkjia.com/PHPjc/326544.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326544.htmlTechArticlea. if you want to use gb2312 encoding, php needs to output the header: header ("Content-Type: text/html; charset = gb2312 "), add meta http-equiv = "Content-Type" content = "text/html ;...