W3C error Non-space characters found without seeing a doctype first. Expected .

If any(absolutely any!) file that take part in construction of the code of final HTML-page(the one to be sended to client) has encoding with BOM – final HTML-page WILL BE UTF-8-BOM. That is: you whole site should NOT contain even 1 file with BOM.