Search code examples
htmlutf-8w3c-validation

<meta charset="UTF-8"> not validating


I am working on a final project for class, but I keep getting an error when I try and validate my site. The errors I am getting are:

  1. Error: The character encoding was not declared. Proceeding using windows-1252.

  2. Error: A charset attribute on a meta element found after the first 1024 bytes.

    At line 15, column 24

    charset="utf-8">↩      <meta nam
    
  3. Error: Changing character encoding utf-8 and reparsing.

    From line 15, column 4; to line 15, column 25

    -->↩   <meta charset="utf-8">↩     <m
    
  4. Fatal Error: Changing encoding at this point would need non-streamable behavior.

    At line 15, column 25

    charset="utf-8">↩      <meta name][1]
    

I'm not sure why I keep getting this, as I haven't had trouble getting things to validate before. I tried moving the <meta charset="utf-8"> to be the first child element in the header, but that ended up causing more errors.

Here is the top portion: (the supporting file page is one line. Is that line to big maybe?)

<!DOCTYPE HTML>
<HTML LANG="EN">
<HEAD>
  <TITLE>NO. 83 COMICS</TITLE>
<!--

  No 83 Comics Website (IS 139 674 Web Publishing Final Project)
  Author: Nate Contini
  Date: 12/06/2018

  Filename: No83Home.html
  Supporting files: Assets/Javascripts/modernizr.custom.62074.js, 
  fonts.googleapis.com/css?family=Marck+Scrhtmlipt, 
  https://fonts.googleapis.com/css?family=Montserrat, Paladin 
  Style.css,Assets/Images/no_83_logo_D6T_icon.ico, 
  connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2, 
  https://www.facebook.com/groups/508106072637180/, 
  https://twitter.com/share?ref_src=twsrc%5Etfw, 
  https://platform.twitter.com/widgets.js, https://www.tumblr.com/share, 
  https://assets.tumblr.com/share-button.js, no 83 home.html, No 83 Gallery 
  Page.html, creator page.html, newsletter Page.html, 
  https://www.amazon.com/, Assets/images/No 83 Logo 2.png, Paladin Bio 
  Page.html, Anne Sullivan Bio Page.html, Mr. Freedom Bio Page.html, Dale 
  Sulivan Bio Page.html,ID Bio Page.html, Obsidian Blaze Bio Page.html,Flash 
  Strike Bio Page.html,Nuclear Ruin Bio Page.html

  -->
  <META CHARSET="UTF-8">
  <META NAME="VIEWPORT" CONTENT="WIDTH=DEVICE-WIDTH">
  <SCRIPT SRC="ASSETS/SCRIPTS/MODERNIZR.CUSTOM.62074.JS"></SCRIPT>
  <LINK HREF="HTTPS://FONTS.GOOGLEAPIS.COM/CSS?FAMILY=MARCK+SCRHTMLIPT" REL="STYLESHEET">
  <LINK HREF="HTTPS://FONTS.GOOGLEAPIS.COM/CSS?FAMILY=MONTSERRAT" REL="STYLESHEET">

Solution

  • Error: A charset attribute on a meta element found after the first 1024 bytes.

    … and you have a massive comment immediately before it which uses up about 1025 bytes by itself.

    Move the <meta> element to before that comment.