Click to See Complete Forum and Search --> : & vs. &


tuka
12-28-2005, 06:12 AM
Hi all,

I have been recently fiddling with some JS URL parsing tool and I run across this comment by the author:

The url must be correctly encoded, ampersands must encoded as &

Just so that I am on top of best practises, would you recommend that I what the above comment says all of the time or part of the time ? when can I just get away with using & alone ?

I program web apps and use the query a lot to pass info. between pages - I tend to thing that because I exert a lot of acontrol on my pages through my apps, I dont see much concern to use & instead. Anyway would like to know your opinions.

TIA,
Tuka

the tree
12-28-2005, 07:02 AM
In text and links, encode ampersands. In scripts, don't.
Could that be any simpler?

ShrineDesigns
12-28-2005, 12:04 PM
if a special character (ex. <>"&) is use in an attribute value it MUST be encode (either urlencoded or converted to an entity)

felgall
12-28-2005, 03:05 PM
Since & represents the start of an HTML entity - all ampersands that you want to use in HTML must be specified using the entity equivalent of &amp;