Pregunta

I wan't to pass validation for this site : http://www.mundo-satelital.com.ar/ but I can't seem to fix the strange character at the start of the file. The W3 validation service automatically detects my page as iso-8859-1 although I can see from the console on Firefox that the header being passed is Content-Type text/html; charset=utf-8 and my <head> contains

<?php header('Content-Type: text/html; charset=utf-8'); ?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

It seems what I'm looking for is a stray BOM character, apparently even one in the php includes can cause this, however I've been using grep -rl $'\xEF\xBB\xBF' *.php and variations of it to search for any .php, .html, .js or .css file that might be the culprit and after eliminating all those that turned up positive the problem is still present, anyone have any ideas?

¿Fue útil?

Solución 2

The header specified, the meta tag and the actual format your file is saved in are three totally different things. Make sure they are all the same. Also, right now you have a new line char (maybe chars if on windows) before your doctype. <?php header ... ?>\n<!DOCTYPE...

Otros consejos

Try to save them as UTF-8 non-BOM. (or without BOM, whatever it is called in your editor). Certainly this is your problem.

Actually i don't see the problem. When you cut and paste your code into validator, it goes without headers. If you set HTML5 doctype and utf-8 by yourself. Nothing will changed. you will still have 44 erors.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top