Re: Validating URLS? why???

vigge_swe wrote:
> I just noticed one thing, when I add 
> "http://www.projectwonderful.com/advertisehere.php?id=27098&type=1 
> <http://www.projectwonderful.com/advertisehere.php?id=27098&type=1>" to 
> my site, my site isn't xhtml 1.0 transitional anymore.
> (http://validator.w3.org/check?uri=http%3A%2F%2Fjagf.net%2Findex.php%3Fsid%3D4770dfc03192f114808792f20258e384;accept=text%2Fhtml%2Capplication%2Fxhtml%2Bxml%2Capplication%2Fxml%3Bq%3D0.9%2C*%2F*%3Bq%3D0.8;accept-language=sv-se%2Csv%3Bq%3D0.8%2Cen-us%3Bq%3D0.5%2Cen%3Bq%3D0.3;accept-charset=ISO-8859-1%2Cutf-8%3Bq%3D0.7%2C*%3Bq%3D0.7)
> 
> The thing is, I really want my site transitional, but ofcourse I have no 
> idea how I should fix a link since it isn't me that own 
> projectwonderful.com <http://projectwonderful.com>.
> 
> So I want to suggest, please don't validate URLs since if I change 
> something in the URL, the URL will become broken

Not a bug. You need to encode the characters in the URL correctly for 
XML (and likely text/html too), just like you need to encode all other 
characters, and the browser will decode the result to retrieve the 
original characters.

In the case of a literal &, it must always be escaped by encoding it as 
an SGML entity (namely &amp;), since &something; implies the user agent 
should look for an entity "something". For example, &mdash; resolves to 
an entity for the em dash.

Please read:

http://en.wikipedia.org/wiki/SGML_entity

http://www.w3.org/TR/REC-html40/charset.html

http://www.w3.org/TR/xhtml1/#h-4.12

http://www.w3.org/TR/xhtml1/#h-A2

The correct HTML for:

http://www.projectwonderful.com/advertisehere.php?id=27098&type=1

would be:

http://www.projectwonderful.com/advertisehere.php?id=27098&amp;type=1

--
Benjamin Hawkes-Lewis

Received on Sunday, 26 October 2008 18:09:24 UTC