[pmwiki-users] url parms with ampersands and w3c validation

Patrick R. Michaud pmichaud at pobox.com
Wed Oct 19 08:12:18 CDT 2005


On Wed, Oct 19, 2005 at 01:28:09AM -0500, Chris Cox wrote:
> According to w3c, you can't have raw apersands in URLs.

One cannot have raw ampersands in an *HTML document*, because the 
ampersand is used to denote character entities.  Thus within an 
HTML document, one has to use "&" instead of "&", even in 
things like src="..." and href="...".  HTML authors often forget
about this when creating HTML.

It's perfectly valid to have raw ampersands in urls; in fact, the
CGI specification explicitly says to use "&" to separate parameters.

> So I figured something like
> 
> [[whatever?blah=1&foo=2]]
> 
> would work.  But the & becomes a regular ampersand inside
> of the link in html and fails validation.

In markup, this should be

    [[whatever?blah=1&foo=2]]

i.e., the actual url as it would appear in the address bar of a browser.  
PmWiki already takes care of converting ampersands to "&" as 
needed in the HTML output.

Pm




More information about the pmwiki-users mailing list