Возникла такая проблема: валидатор validator.w3.org выдает предупреждение: "Byte-Order Mark found in UTF-8 File.The Unicode Byte-Order Mark (BOM) in UTF-8 encoded files is known to cause problems for some text editors and older browsers. You may want to consider avoiding its use until it is better supported."
Проверила файлы, которые изменяла, в Notepad++, кодировка везде UTF-8(без BOM). Скрипт, который ищет и удаляет BOM, не находит на сайте этого знака. Установила плагин HTML validator для Firebug. Он тоже ничего не находит.
Если кто знает, как и где искать этот неуловимый знак, напишите, пожалуйста.
Комментарии
Создай файл php. И добавь в него нижеприведенный код. Запусти, произнеси "Кыш злосчастные знаки" и они уйдут.
<?php
// Tell me the root folder path.
// You can also try this one
// $HOME = $_SERVER["DOCUMENT_ROOT"];
// Or this
// dirname(__FILE__)
$HOME = dirname(__FILE__);
// Is this a Windows host ? If it is, change this line to $WIN = 1;
$WIN = 0;
// That's all I need
?>
UTF8 BOM FINDER and REMOVER
body { font-size: 10px; font-family: Arial, Helvetica, sans-serif; background: #FFF; color: #000; }
.FOUND { color: #F30; font-size: 14px; font-weight: bold; }
<?php
$BOMBED = array();
RecursiveFolder($HOME);
echo '
These files had UTF8 BOM, but i cleaned them:
';
foreach ($BOMBED as $utf) { echo $utf ."
\n"; }
echo '';
// Recursive finder
function RecursiveFolder($sHOME) {
global $BOMBED, $WIN;
$win32 = ($WIN == 1) ? "\\" : "/";
$folder = dir($sHOME);
$foundfolders = array();
while ($file = $folder->read()) {
if($file != "." and $file != "..") {
if(filetype($sHOME . $win32 . $file) == "dir"){
$foundfolders[count($foundfolders)] = $sHOME . $win32 . $file;
} else {
$content = file_get_contents($sHOME . $win32 . $file);
$BOM = SearchBOM($content);
if ($BOM) {
$BOMBED[count($BOMBED)] = $sHOME . $win32 . $file;
// Remove first three chars from the file
$content = substr($content,3);
// Write to file
file_put_contents($sHOME . $win32 . $file, $content);
}
}
}
}
$folder->close();
if(count($foundfolders) > 0) {
foreach ($foundfolders as $folder) {
RecursiveFolder($folder, $win32);
}
}
}
// Searching for BOM in files
function SearchBOM($string) {
if(substr($string,0,3) == pack("CCC",0xef,0xbb,0xbf)) return true;
return false;
}
?>