Forum Moderators: phranque

Message Too Old, No Replies

Encoding problems with html validation

         

operafan

11:32 am on Mar 4, 2004 (gmt 0)

10+ Year Member



I tried validating my site via w3c.org and got this error
<quote>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.</quote>

I did some modifications on the httpd.conf and I dont know if it's the one that's affecting it.
I suspect it's the Addlanguage settings where I disabled all but one en - becoz me site is only in english - could that be the problem?

But strange thing is I also uploaded the file to validate & it had the same message error, but when I tried it on CSE lite it's ok.

grahamstewart

11:48 am on Mar 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A very common problem.

You need to specify which character encoding your web page uses.
The best way to do this is to add this line..

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

..inside the <head> of the document.

That specifies that the page uses the ISO Latin 1 character set, which should be fine for any english based document. If you used foreign or more unusual characters then you might want to consider the

utf-8
character set instead.

grahamstewart

11:50 am on Mar 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Note: this can also be specified in the Content-type header from your web server. But the advantage of doing it this way is that if the user saves the file to disk it will retain its character set information.

Mohamed_E

1:17 pm on Mar 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A few months ago encyclo and Longhaired Genius taught me about the AddDefaultCharset directive:

[webmasterworld.com...]
[webmasterworld.com...]

The problem, of course, is that some validators (including the w3c.org one) will refuse to validate files on my computer, since they do not have access to the charset. The Web Design Group's validator allows you to input the charset on the validation page, and Tidy seems to assume ISO-8859-1 or even ASCII.

The advantage of having the server supply the charset is that a single line of code does the job for the entire site.

grahamstewart

1:32 pm on Mar 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The Web Design Group's validator allows you to input the charset on the validation page

Ummm.. the w3c validator lets you do this too. :)

That's what the 'Encoding' drop-down is for on the [validator.w3.org...] page

Mohamed_E

1:45 pm on Mar 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The number of times I have looked at that page without seeing that option ... :)

Many thanks!

operafan

12:44 am on Mar 5, 2004 (gmt 0)

10+ Year Member



Okie, thanks Graham.

Fischerlaender

5:06 pm on Mar 5, 2004 (gmt 0)

10+ Year Member



There is another advantage specifying the character encoding in the meta tag: Once you change your web server or hosting service, chances are you forget to specify the encoding in the server configuration files. If you put the encoding in the meta tag however, your pages become more "compatible".