Bug 13592 - HTML in ListItem is rendered as text
Summary: HTML in ListItem is rendered as text
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-07-30 04:29 UTC by APS
Modified: 2013-07-30 04:33 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 13592 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description APS 2013-07-30 04:29:18 UTC
Hi,

Creating a dropdownlist with a ListItem like this:

<asp:ListItem Value="3" Text="">&nbsp;</asp:ListItem>

Mono 2.0 renders:
<option selected="selected" value="3">&#160;</option>
Mono 3.0.7 renders:
<option selected="selected" value="3">&amp;nbsp;</option>
MS ASP.NET 4.0 renders:
<option selected="selected" value="3"></option>

The Mono 3.0.7 version is the worst because it displays "&nbsp;" to the end user. According to documentation http://msdn.microsoft.com/it-it/library/system.web.ui.webcontrols.listitem.aspx the correct result should be:
<option selected="selected" value="3">&nbsp;</option>
Comment 1 APS 2013-07-30 04:33:53 UTC
Forgot to say that I fixed the problem on my installation but I can't say if it's correct.
I modified mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs removing HtmlEncode on text when it's written in the inner html:

Line 380 from:

   string encoded = HttpUtility.HtmlEncode (item.Text);
   writer.Write (encoded);
   writer.WriteEndTag ("option");

to

   //string encoded = HttpUtility.HtmlEncode (item.Text);
   writer.Write (item.Text);
   writer.WriteEndTag ("option");