[thelist] Rules of Using & and &, etc...

aardvark roselli at earthlink.net
Wed May 10 12:49:14 2000


- the & should be used in all instances of the '&' on a page, 
even in a URL (http://foo.com/foo.asp?foo=1&foo2=2 for 
example)... that being said, i don't see it done much, and it takes 
me a while to use it... however, now that so many of my sites are 
db-driven, i replace the & with the & when it goes into the db...

- the " follow the same basic rules as the &... i now 
always replace " with this with content going into a db... otherwise 
it can mess up my SQL queries...

- you should *always* use a &gt; or &lt; if you want to display a '<' 
or a '>' on a page...if you don't, a browser may (correctly) assume 
it is a tag...

- as for numeric vs. character entity... i use the numeric for all but 
the &amp;, the &lt;, and the &gt;... i've found that some older or 
alternative browsers choke on even the &quot; and &copy;, among 
all the others... 

> From: Gregory.John.Toland@ccmail.census.gov
> 
> What are the rules for using &amp; as opposed to the actual &
> character in HTML coding?  I noticed sometimes people (in-house) have
> the symbol &amp; in their code and other times they have used &.  The
> same for &quot; versus the symbol " or &lt; versus the symbol <.  The
> general question is when do you use the character & and when do you
> use the numeric entity (&#38;) or the character entity (&amp;)? 
> Thanks for any help you can give.