PHP Chinese garbled problem in PHP can be said to appear frequently, yesterday in the local environment to create a file, file encoding is UTF-8 format, printing a simple statement on the appearance of Chinese garbled, tossing a long time, only to find the reason. Here's how to solve this problem and document the solution here.
Garbled problem:
Yesterday wrote a very simple PHP output Chinese page, but there is garbled problem, the first reaction may be the script file encoding format has a problem, looked under, no problem, the original file code for Utf-8, what is the reason?
This problem first encountered, although the output page can be added <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>, can be temporarily resolved, but this method does not solve the problem, from the fundamental solution, and later on the Internet, the original is php.ini configuration of the default character set problem.
Workaround:
Open a. php.ini file, find;d efault_charset = "Iso-8859-1", instead: Default_charset = "UTF-8" Remove the preceding semicolon (remove the comment), change the character set to UTF-8, restart the Apache service, Refresh the page, Chinese display is normal.