Re: Parsing HTML href-Attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/1/09 23:41, Shawn McKenzie wrote:
Again, I say that it won't work on URLs with spaces, like "my web
page.html".  When I get a minute I'll fix it.  I thought spaces in URLs
weren't valid markup, but it seems to validate.

Some small points of information:

An HTML4 validator will only check that a HREF value is CDATA, as required by the DTD:

http://www.w3.org/TR/REC-html40/struct/links.html#adef-href

http://www.w3.org/TR/REC-html40/sgml/dtd.html#URI

http://www.w3.org/TR/REC-html40/types.html#type-cdata

Plenty of things can be CDATA without being a valid URI:

http://gbiv.com/protocols/uri/rfc/rfc3986.html

Space characters (U+0020) that are not percent encoded are not valid in a URI:

http://gbiv.com/protocols/uri/rfc/rfc3986.html#collected-abnf

That's not to say that browsers haven't developed error handling for space characters (and other illegal characters) in HREF values.

The HTML5 draft proposes an algorithm for parsing and resolving HREF values that includes such error handling:

http://www.whatwg.org/specs/web-apps/current-work/#parsing-urls

http://www.whatwg.org/specs/web-apps/current-work/#resolving-urls

--
Benjamin Hawkes-Lewis

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux