Announcement
Collapse
No announcement yet.
HTML Validator
Collapse
X
-
The validator needs to know what charset, or encoding, your page has, in order to validate it. (And a browser parser that doesn't know has to either guess or try to divine it from the document somehow. Which means that things can be misinterpreted.)
The HTTP headers doesn't return any charset:
Code:http://64.141.105.108/index.html GET /index.html HTTP/1.1 Host: 64.141.105.108 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Firebird/0.7 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 Accept-Language: en-gb,en;q=0.7,en-us;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive HTTP/1.x 200 OK Date: Sat, 07 Feb 2004 23:20:15 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_jk/1.2.0 mod_perl/1.26 PHP/4.3.3 FrontPage/5.0.2 mod_ssl/2.8.12 OpenSSL/0.9.6b Last-Modified: Sat, 07 Feb 2004 22:57:48 GMT Etag: "107000f-21f9-40256d6c" Accept-Ranges: bytes Content-Length: 8697 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive [color=red]Content-Type: text/html[/color]
You may specify it in the document as a meta tag as well. The meta tag should be the first tag after the opening head tag and looks like this:Code:<meta http-equiv="Content-Type" content="text/html;charset=[i]DocumentCharset[/i]">
If you're using XHTML you may use the encoding attribute of the XML prolog, like this:Code:<?xml version="1.0" encoding="[i]DocumentCharset[/i]"?>
As for the charset you should use, utf-8 (Unicode, good for most Indoeuropean language), iso-8859-15 (Revised Latin-1, called Latin-9 by W3C), iso-8859-1 (Old Latin-1), or good old us-ascii (Basic English) seems like the best choices, unless you use one of the iconographic asian languages.Last edited by liorean; Feb 7, 2004, 07:36 PM.liorean <[[email protected]]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards
Comment
Comment