W3C home > Mailing lists > Public > www-validator@w3.org > November 2000

Re: W3C validators and url encoding

From: Joel Yliluoma <bisqwit@w-create.com>
Date: Thu, 2 Nov 2000 18:25:05 -0500 (EST)
To: Terje Bless <link@tss.no>
Cc: W3C Validator <www-validator@w3.org>
Message-ID: <Pine.LNX.4.20.0011030115520.20575-100000@winnie>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:13:54 GMT