[thelist] Escaping "</textarea>"

Paul Cowan evolt at funkwit.com
Mon Dec 22 16:47:43 CST 2003

Tab Alleman wrote:
> Now of course, this begs the question how would I get a textarea to
> contain "&lt;" as a literal string of characters and not have it display
> a "<", but I don't want rocks thrown at me, so I won't ask.  : )
> (actually, I suppose "&amp;lt;" would do it, huh?  What a PITA...lol)

Got it in one!

Technically, it doesn't matter whether it's in a textarea or not. If
you're using a '&' '<' or '>' in any context other than as the beginning
of an entity, or an opening or closing of an HTML tag (respectively), you
need to encode them in precisely that format if you wish to have valid

	<a href="http://somewhere.woot/blah?a=1&b=2">
is not valid HTML;
	<a href="http://somewhere.woot/blah?a=1&amp;b=2">

Not escaping these 3 HTML characters _everywhere_ will probably work for
you anyway 99.9% of the time -- but if you want valid HTML, you have to do



More information about the thelist mailing list