XHTML Validation Query. Links off page

Have written a small site in XHTML and it has clean Validation for what I have written except for some links out to another site. The Validator is coughing on those links. What does one do in this situation? If I change the links they wont work.

Any ideas gratefully received. Thank You.

Hello and welcome to SitePoint! :wave:

Do you have a URL? What’s in the URL should be of no concern unless the HTML around it is invalid in some shape or form.

One of them is this. I have removed leading < and trailing > in case it causes problems on here.

a href=“http://www.rics.org/site/scripts/documents_info.aspx?documentID=105&pageNumber=1”>buying a home</a

Does it give a somewhat cryptic message about &'s and ='s?

I only say because I notice the &'s are not escaped, and for whatever reason, this also causes the validator to pull additional errors about the = signs. Do the errors go away if you escape the &? ([noparse]&[/noparse])

Does it give a somewhat cryptic message about &'s and ='s? Yes!!!

I don’t understand “escaping the &”. It’s my first XHTML and it’s all rather new to me.

Do you mean replace the ‘&’ with (& or & ) and the ’ = ’ with er? er? what?

You need to encode special characters (spaces, ampersands, percentages, equal signs, etc.) that can be misinterpreted (“choked on”) by the browser.

Here is a link explaining url encoding for special characters and the corresponding code for each character. I’ve only ever seen the hexidecimal encoding used in urls and they’re pretty easy to remember and recognize, once you know what they are you notice them all over the place.
http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

The most common encoding issue is that you won’t be able to access a file with a special character in a file name unless you properly encode the url in the link.

Example of replacing a special character:
/file with spaces.html
You probably wouldn’t be able to access this file on the server if you keep the spaces. The issue is fixed once you replace the spaces with the hex encoding “%20”.
/file%20with%20spaces.html


Ampersand would be %26
Equals sign would be %3D

Thanks everyone. I’ll try your suggestion huit and see how it works out. If not I’ll be back. Thanks for the warm welcome to this forum. I thought I was doing so well…

Luckily, the &'s can be escaped with named character entities, both in HTML and XHTML (it’s one of XHTML’s 5 named entities), so replacing & with [noparse]&[/noparse] will do the trick. http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references ← I have this page bookmarked : )
Notice all the other entities begin with the & symbol… ah yes, that’s why it’s a problem when you say “Ben & Jerry’s”.

The = is a red herring: because the validator sees an unescaped &, it’s totally confused by the =. However, = is fine and the error for it will go away once the & is taken care of : )

Spaces are hit and miss. Many browsers seem to still be able to use links with spaces, because browers often convert urls themselves (as they are doing with your &'s… your browsers had no trouble with the links, only the validator did). However I’ll agree with huit in escaping any spaces in urls, just as a good practice. For the rest of the symbols, though, escaping things like = only come in to play when you’re doing regular expressions, or url-rewriting in Apache or something.

Boy! You guys are good. I can’t thank you enough. I do love clean code.
Thank you all very much. the %26 did the trick nicely.