Re: First two bytes of a file

On Fri, 21 Nov 2003, David Edwards wrote:

> --BEGIN PERL CODE--
>
> #!/usr/bin/perl -w
>
> #please note that the total number of newlines in the following first two lines is three
>
> print qq|Content-type: text/html\n\n

You've declared text/html, so we need to apply HTML rules.  So there's no
problem with leading whitespace in your document.


> <?xml version="1.0"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

That's XHTML 1.1, which is not a valid HTML doctype.  The validator should
complain.

> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
> <head>
> 	<title>No CSS Validation</title>
> 	<link rel="StyleSheet" href="default.css" type="text/css"
> 		title=default media="screen" />
> </head>
> <body><p>The Jigsaw CSS validator will refuse to validate the generated
> XHTML, due to "bad" XHTML, even though the XHTML validator reports conformance.</p></body>
> </html>|;


That is, typos aside, valid XML and XHTML.  If you send it with an XML or
XHTML Content-Type, you get the behaviour you expected (or report a bug).

-- 
Nick Kew

Received on Sunday, 23 November 2003 17:12:57 UTC