Home  >  Article  >  Backend Development  >  PHP source code encoding and conversion appears "锘匡豢"

PHP source code encoding and conversion appears "锘匡豢"

WBOY
WBOYOriginal
2016-07-29 09:02:101848browse

"锘匡豢" 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

  1. Encoding problems may lead to various inexplicable problems
  2. Notepad++ is a good thing. . . .
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn