Forum Moderators: open

Message Too Old, No Replies

Validation and Char Encoding

No Char encoding detcted?

         

Nick_W

7:22 am on Jan 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

The code below always used to validate and, there is a char encoding specified. So, why does the html validator say it cannot detect any char encodeing?

And more to the point, how might I fix this?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<?xml version="1.0" encoding="iso-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

Many thanks..

Nick

andreasfriedrich

7:47 am on Jan 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The xml declaration needs to be the first thing in the document.

<?xml version="1.0" encoding="iso-8859-1"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

[w3.org...]

However, this will cause IE6 to switch to quirks mode. Specify the encoding in the HTTP header. There was a thread on this some time ago.

Andreas

andreasfriedrich

7:52 am on Jan 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding was determined by a higher-level protocol.

[w3.org...]

The HTTP is such a higher level protocol.

The W3C recommends that for backwards compatibility anyway.

In order to portably present documents with specific character encodings, the best approach is to ensure that the web server provides the correct headers.

[w3.org...]

Nick_W

8:03 am on Jan 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks andreas, I knew about the xml first bit, it used to validate fine though. Looks like I'll have to settle for it though as the other options aren't that feasible in this situation.

I thought maybe I could specify it elsewhere...

Cheers..

Nick

g1smd

4:14 pm on Jan 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Which validator did you use? If it was [validator.w3.org...] then be aware that that one was completely re-written a month or so back, and it does now work a little differently to the old one.

[edited by: g1smd at 4:18 pm (utc) on Jan. 19, 2003]

Nick_W

4:17 pm on Jan 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks g1smd

I had noticed the layout change but thought ir just a visual thing...

Nick