Closed Bug 109781 Opened 23 years ago Closed 23 years ago

nbsp mistakenly interpreted in textarea tag

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
critical

Tracking

()

RESOLVED INVALID

People

(Reporter: chris+bugzilla, Assigned: rods)

References

()

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:0.9.5+) Gecko/20011106
BuildID:    20011106

This HTML code fragment:

-----------------
<form>
<textarea>
unspaced text
  spaced text
&nbsp; nbsp-spaced text
</textarea>
</form>
-------------------------

(also at the url above) renders a textarea widget with the &nbsp; parsed into a
space, not as plain text.

Reproducible: Always
Steps to Reproduce:
1. go to the url http://www.clotho.com/staff/chris/moztest/textareatest.html
2. Note that the nbsp does not appear literally in the textarea


Actual Results:  The character tag is interpreted

Expected Results:  Text inside the <textarea> tags should not be interpreted
The specification for textarea doesn't say that &nbsp; should not be interpreted.

http://www.w3.org/TR/html4/interact/forms.html#h-17.7

IMO Mozilla is right here.

What you can do is chnage the &nbsp; to &amp;nbsp; 
The current behavior is correct -- entity and character references inside 
TEXTAREAs (and any other form element) are interpreted, but markup is not.
This means that you must doubly encode character/entity references inside
textarea elements if you want them returned as such references to the browser.
All browsers (IE, Navigator 2/3/4, etc.) behave in this way.

To verify this for yourself, take a test documemt such as:

<form>
<textarea rows="10" cols="60">
<h1> Heading h1 </h1>
ouml:  -:&ouml;:- 
ltL    -:&lt;:-
nbsp:  -:&nbsp;:-
#189:  -:&#189;:-
</textarea>
</form>

and try it on various browsers (189 is the 1/2 symbol) -- you'll find 
that the character and entity references are interpreted by all 
browsers.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
OK, thank you for the lesson.  I do appreciate it.  Sorry about the bad report.
*** Bug 205229 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.