Re: W3C validators and url encoding

On Thu, 2 Nov 2000, Terje Bless wrote:
> You made your point just fine, but I'm having trouble wrapping my head
> around the multiple levels of encoding going on here. I /think/ I see where
> we're going wrong, but I'll have to test some to make sure. .diff once I
> get it... :-)

Just encode the urls twice.

In php, it would be:

$link = 'foo.cgi?uri='.urlencode($uri).'&foo='.urlencode($foo);

print '<a href="';
print htmlspecialchars($link);
print '">Clicketi click</a>';

Got it? Urlencode the parameters, and
htmlencode the anchor href-parameter,

urlencode() encodes any & to %26, and
htmlspecialchars() encodes any & to &amp; .

:)

-- 
NETTIPAJA OY               Joel Yliluoma
Tel. (09)2586 1010         Software designer
http://www.nettipaja.fi/   http://iki.fi/bisqwit/

Received on Thursday, 2 November 2000 18:31:33 UTC