HTML validation error: Non-space characters found before DOCTYPE HTML validation error: Non-space characters found before DOCTYPE wordpress wordpress

HTML validation error: Non-space characters found before DOCTYPE


I found the root of problem. The general rule is:

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.

In my case I have total 1.3K files that make up my site. Only 4 files was BOMed:

  • wp-config.php (in root of site)
  • jquery.query.js (in include folder)
  • cyr-to-lat.php (in plug-in folder)
  • footer.php (in theme root folder)

And I was forced to re-save every and all of these 4 files as "UFT-8 without BOM" to get rid of "Non-space characters" validation error. When I did this (re-save files) - error is gone.