Improve documentNotUTF8 check in ToolsError for HTML support

Improve documentNotUTF8 check to allow <meta> character set declarations in HTML documents:

- Considers `<meta http-equiv="content-type" content="text/html; charset=UTF-8">` to be a valid charset declaration
- Considers `<meta charset="UTF-8">` to be a valid charset declaration
- Permits the encoding attribute of the relevant tag to appear anywhere within the tag (currently in the `<?xml` variant it must be the last attribute)
- Permits the HTML variants to specify `UTF8` as well as `UTF-8` (all browsers forgive this mistake and understand it). The XML variant remains strict on this point.