Home >
Article > Backend Development > Xiaotan Vim opens
After uploading the PHP program developed on the local Windows machine to the Linux server, I accessed the corresponding interface through the browser and found that there was an inexplicable character '-' in front of the returned data. I was very puzzled. Afterwards, through network packet capture, we found that there were more EF BB BF before the interface returned data. It's always extremely frustrating to have bugs like this happen for no apparent reason. After several attempts, it still couldn't be solved, but I also vaguely felt that it might be a character encoding problem, so I used PHPStorm to create a new file, and then rewritten the contents of the previously buggy file (fortunately, the file was not too big). Yes, if you use svn, you should roll the file back to the previous bug-free version) and then upload it again. The problem is actually solved. I gave it up in joy without delving into the reasons. G originally thought that the bug was lifted, and after that, I encountered it again, and I couldn't bear it. This time, the method of viewing the code is not to change it on the local machine and then re-upload it to the server, but to open it directly on the server with vim and view it line by line. The result was a surprise. The vim file header showed an extra ‘
Here we first talk about utf8, utf16, and utf32 encoding. Because this encoding corresponds to multiple bytes, generally utf16 and utf32 will use BOM (Byte Order Mark, which is an invisible character) to identify internally encoded words. Endian (Big/Little Endian), and utf8 can be added with or without BOM. Generally, the utf8 encoding of the editor we use does not add a BOM identifier, but Notepad under Windows will add a BOM identifier in front of the utf8 encoded file. This BOM logo corresponds to the
PS: It’s better to use Notepad less to open or edit utf8 encoded codes, a bloody lesson! ! !
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.The above introduces the
at the beginning of the file opened by Xiaotan Vim, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.