"锘匡豢" occurs when encoding and converting PHP source code
1. Related information
After directly converting PHP source code to UTF-8, you are likely to encounter the following two problems:
1. The first line of code is empty;
2. There are multiple "锘匡豢" in the top row;
The reason for the above problem can be found in the Wiki BOM entry. The solution is also very simple. After converting to UTF8, the BOM problem can be solved. Converting using Notepad++ will be easier and safer.
2. Problem description
There is a blank line in the first line of the HTML page output or the word "锘匡豢" appears
3. Solution
Use Notepad++, open all the files that need to be converted, and then click the menu "Encoding" ” → “Convert to UTF-8 without BOM (Convert to UTF-8 without BOM encoding format)”, and then save the file to complete the conversion without any problems.
By the way, Notepad++ is indeed a very excellent editor and can be used as your main coding tool under Win - it is already the only coding tool I use under Win.
Notes:
1. When specifying the encoding in the HEAD part of HTML, charset may be set, and the value can be changed to UTF8;
2. Default encoding settings in web servers such as apache. Modify apache in CentOS in httpd.con, search for "AddDefaultCharset", and change the subsequent value to UTF-8;
3. Modification of CSS file encoding;
Taobao also uses gbk, and the conversion must be a torturous process.
4. Analysis and Summary
The above has introduced the "锘匡豢" in PHP source code encoding and conversion, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.