Forum Moderators: open

Message Too Old, No Replies

Validation

Character Encoding

         

D_Blackwell

7:34 am on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have just begun to validate my style sheets with good success.

However, in expanding my horizons I've hit a block with validating HTML. The W3C validator kicks back:

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.

I haven't a clue what to do. I write all my code on notepad. Is there a default for this sort of thing?

How do I find out what the encoding is?

Should I have a preference?

Paul in South Africa

7:39 am on Jul 2, 2003 (gmt 0)

10+ Year Member



Have a look at ht*p://www.w3.org/TR/REC-html40/charset.html It should help. The one I use most of the time is
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

Mohamed_E

12:19 pm on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you use the META HTTP-EQUIV suggested by Paul in South Africa you must include it in every file. If you can use a .htaccess file a single line with:

AddType 'text/html; charset=ISO-8859-1' html

will cover all the files in that directory.

Paul in South Africa

12:36 pm on Jul 2, 2003 (gmt 0)

10+ Year Member



Thanks Mohamed.

That's what I love about this place.

You share a bit of your knowledge (in my case limited) and then someone else comes along and teaches you something you didn't know.

If it is included in .htaccess will the page still validate?

Mohamed_E

1:02 pm on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> If it is included in .htaccess will the page still validate?

Yes, that is what I use on my main site.

I am assuming that the normal way for a web server to inform the client of the encoding is through HTTP header, not HTML. I am assuming that the META HTTP-EQUIV is a poor man's attempt to mimick that behaviour if he cannot directly control the HTTP header.

Just did a test with Brett's Server Header Check [webmasterworld.com].

On my main site (using .htaccess) I get:

Content-Type: text/html; charset=iso-8859-1

On my Geocities toy site (using meta) I get:

Content-Type: text/html

While posting in one window I was checking w3.org in another, they state it all explicitly in 5.2.2 Specifying the character encoding [w3.org].

Paul in South Africa

1:26 pm on Jul 2, 2003 (gmt 0)

10+ Year Member



Thanks a lot, it is a bit clearer now. I did say my knowledge was limited.

Mohamed_E

1:42 pm on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



IMPORTANT CORRECTION: In msg #3 I stated that the .htaccess file would cover all files in that directory. I started having doubts, and checked out Apache HTTP Server Version 1.3 .htaccess files [httpd.apache.org] documentation. Sure enough, it says:

.htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.

Please note the "and all subdirectories thereof".