XHTML Ampersands in URLs Opera problem fix

November 27, 2007 Filed under: php, programming — Tags: , , — catalin @ 8:40 pm

While working on validating a site for XHTML 1.1 I replaced the ampersands from URLs so they get valid.
This is invalid: <a href=”index.php?bla=one&foo=two”>click here</a>
This is valid: <a href=”index.php?bla=one&amp;foo=two”>click here</a>

IE and Firefox treat these links correctly, that is, they escape &amp; and when you click on a link they send the right link, using only &. Problem is, that Opera version 9.24 is sending the links in the wrong way, is not escaping &amp; and is sending it like that when you click the link and you see in the browser in the address bar something like this:

index.php?bla=one&amp;foo=two
(more…)