Why is this HTML5 document invalid?

html

Solution

Well, it depends on what you are using.

- if you are using the File Upload option, it depends on which encoding the HTML file was saved with.

- if you are using the Direct Input option, it depends on the navigator.

If you don't want the validator to guess, and use UTF-8, you can add the following line

<meta charset="UTF-8">

inside the the head element.

Problem

I'm getting pretty confused about an error message I'm getting when I try to validate any simple HTML document without a meta encoding like this: ``` <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body>Test</body> </html> ``` The W3C validator reluctantly accepts the document as valid with just a few warnings when it is pasted into the direct input form, but when the document is uploaded or loaded by URI, validation fails with this error message The character encoding was not declared. Proceeding using windows-1252. There are two things I don't understand about this error: - Why is a missing character encoding considered an error, when fallback rules exist? - Why is the validator assuming Windows-1252 instead of UTF-8, like any browser would? What is the explanation for these two points?

Original source