Recently found in the PHP program on Windows The output of the Chinese garbled situation.
Read a lot of post information can be added on the page:
Http://www.cnblogs.com/leandro/archive/2008/04/21/1368517.html
With the echo output of the Chinese display as garbled, in fact, it should be a variety of server scripts will encounter this problem, is still a coding problem, generally for the sake of encoding compatibility most of the pages are defined as Utf-8<meta http-equiv= "Content-type "Content=" text/html; Charset=utf-8 "/> This time to normal display of Chinese need to convert the encoding method, such as Echo iconv (" GB2312 "," UTF-8 "," Chinese "); There are other ways, such as adding headers to the echo of PHP ( "content-type:text/html;charset=gb2312"); Of course, the Simplified Chinese page can simply, put <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/> In the UTF-8 changed to gb2312 actually encountered strange phenomenon, in the local server on the normal display of the page, transmitted on the server echo out garbled, did not carefully ponder over this reason, because through Iconv function GB2312, UTF-8 change position re-coding under normal, but it is certainly Apache, more specifically the PHP service side of the settings caused by different, see php.ini should be able to solve.
Add echo iconv ("GB2312", "UTF-8", "Chinese") on each page, or <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/> will be more painful.
Finally, if you see a php.ini file configuration problem, open the php.ini file, locate the;d efault.charset= "UTF-8"--->default.charset= "UTF-8" Remove the preceding semicolon (remove the comment), Restart Apache service, refresh the page, Chinese display is normal.
Record again, hope to help meet the same problem of friends!
PHP Output Chinese garbled solution (reprint)