In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to solve the problem of invisible characters 65279 in php". In daily operation, I believe many people have doubts about how to solve the problem of invisible characters 65279 in php. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "how to solve the problem of invisible characters 65279 in php". Next, please follow the editor to study!
The php invisible character 65279 is interpreted as follows:
UTF-8-encoded files can be divided into two formats: no BOM and BOM.
What is BOM?
The three bytes of "EF BB BF" are called BOM, and the full name is "Byte Order Mard". BOM is often used in utf8 files to indicate that this file is a UTF-8 file, while BOM is intended to be used in utf16.
Bom is exported when utf-8 files are exported in php, so to use utf-8 in php, you must use utf-8 files without bom headers.
Commonly used text editing software does not support saving utf-8 files in the same way, so you should pay special attention to it when using it.
For example:
1. When using ultraedit, there are two options: "UTF-8" and "UTF-8-No BOM" when saving.
2. Window's notepad is kept with bom.
3. Different versions of EditPlus software have different support for utf-8. For example, version 2.31 saves without bom and version 2.11 saves with bom.
How to remove the header of the utf-8 file:
1. Save using ultraedit, and select "UTF-8-No BOM"
2. A very useful php program that runs in the root directory of the site will remove the bom headers of all utf-8 files in the directory, as follows:
/ / remove the utf-8 boms / / by magicbug at gmail dot com if (isset ($_ GET ['dir'])) {/ / config the basedir $basedir=$_GET [' dir'];} else {$basedir='.';} $auto = 1; checkdir ($basedir) Function checkdir ($basedir) {if ($dh = opendir ($basedir)) {while (($file = readdir ($dh))! = = false) {if ($file! ='. & $file! ='..') {if (! is_dir ($basedir. "/". $file)) {echo "filename $basedir/$file" .checkBOM ("$basedir/$file"). "
";} else {$dirname = $basedir." / ". $file; checkdir ($dirname);} closedir ($dh);}} function checkBOM ($filename) {global $auto; $contents = file_get_contents ($filename); $charset [1] = substr ($contents, 0,1); $charset [2] = substr ($contents, 1,1) $charset [3] = substr ($contents, 2,1); if (ord ($charset [1]) = = 239 & & ord ($charset [2]) = & & ord ($charset [3]) = = 191) {if ($auto = = 1) {$rest = substr ($contents, 3); rewrite ($filename, $rest); return ("BOM found, automatically removed.");} else {return ("BOM found.") } else return ("BOM Not Found.");} function rewrite ($filename, $data) {$filenum = fopen ($filename, "w"); flock ($filenum, LOCK_EX); fwrite ($filenum, $data); fclose ($filenum);} at this point, the study on "how to solve the problem of invisible characters 65279 in php" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.