I have a file that I am getting a very weird error on. The error is:
The character encoding of the HTML document was not declared.
The document will render
I had similar problem But teh exact reason behind this was that I missed following to add
<meta content="utf-8" http-equiv="encoding">
in head tag after
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
The error is coming because the browsers expect the encoding format in the first 1024 bytes of the file. It may be the case that there is some content being outputted by the included files in the first case.
The browsers now buffer the first 1024 bytes of the file to check for the character encoding. If the encoding description is not encountered in the first 1024 bytes, this warning is displayed.
In your case, you can use a php header for specifying the content type before the other files are included:
header('Content-type: text/html; charset=utf-8');
For more information, read this: http://gtmetrix.com/specify-a-character-set-early.html