XHTML output for a single line of text is not encoded correctly

  •  09-06-2011, 4:10 PM

    XHTML output for a single line of text is not encoded correctly

    I am able to reproduce this issue on the XHTML demo site: http://cutesoft.net/example/xmloutput.aspx
     
    On that page, supply this single line of text in the text entry box:
     
    This & That
     

     Then click Submit. The produced output is:

    <div>This &amp;amp; That</div>
     
    Note that the text is incorrectly encoded, in that it has an extra "amp" that shouldn't be there.
     
    Now, put the cursor back in the text entry box, at the end of the line of text. Press Enter to supply a carriage return. Click Submit again. The output for that is:
     
    <div>This &amp; That</div><div>&nbsp;</div>
     
    Note that the ampersand between "This" and "That" is now correctly encoded. I've tested this is both Chrome and IE9, and experienced the same behavior.
     
    Is this a bug? Can it be fixed? Is there a workaround?
     
    Thanks. 
    Filed under: , ,
View Complete Thread