View Full Version : I cant grasp this validation bizniss
This is what i get from the w3c HTML validator.
I was not able to extract a character encoding labeling from any of the valid sources for such information. Without encoding information it is impossible to validate the document.
This is the start of my document:-
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Perhaps that is wrong or that I am missing something but I've been reading all evening and am about to blow a fuse !
I would really appreciate a pointer.
much thanks
Bazz
liorean
05-14-2003, 12:10 AM
The possible sources are:
HTTP Header: Content-Type
text/html;charset=utf-8
XML Declaration (For documents served as XML)
encoding="utf-8"
HTML Meta: HTTP-Equiv
http-equiv="Content-Type" content="text/html;charset=utf-8"
Or, change 'text/html' to one of the XML content types.
In other words, see to that you have the meta tag in the html since it's the one thing that doesn't depend on the HTTP header Content-Type.
whilst I was away, I managed to validate it correctly in html 4.01.
this is the top of my document.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
The daft thing is that i want to validate in XHTML for max cross device accessibilty (if that is the way to say it). I recognise the DOCTYPE code and what it does but I cant work out the XHTML verison.
if you could translate this code to the necessary for validating in XHTML it would be a great help.
Now I'm off to re hash my css since ALL the text font sizes apparently dont have enough information. They are a mixture of 8pt and 10pt but apparently that aint enough. I feel another 5am finish coming on :(
Hope you dont think I'm bumping. I just got it sorted. An old brain turning lsowly has done it. Validated as Html but I found the header for XHTML so Im off to do it now. Css is good too :)
I love progress :p
liorean
05-14-2003, 09:51 AM
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
As I said, the encoding="utf-8" in the XML prolog only works if you are serving the document as XML. Which means, if your HTTP Content-Type header contains 'text/html' it will not work. In html parsing, the XML prolog lacks meaning.
All this means one thing: you should have the meta tag in your document no matter if it's XHTML or HTML, as long as it's parsed as html.
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
brothercake
05-14-2003, 12:38 PM
Does that mean that documents which do have an XML processing instruction and which are served as XML, don't need the meta content-type?
liorean
05-14-2003, 06:59 PM
Yep. The meta tag is only needed if there's no http header or xml prolog telling the user agent what charset it is written in.
Note, however, that for some charsets only the http headers work - those that are neither unicode nor supersets of US-ASCII. (I don't think I know of any EBCDIC enabled HTTP/XML user agents, though...)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.