Steps:
- Load an MVC 4 project.
- Go into a view (e.g., ~/Views/Shared/_Layout.cshtml).
- Add an attribute to an HTML element and make its value something that is already attribute-encoded and wrapped in
@Html.Raw.
-
Run site and find the title attribute is encoded, despite being run through
@Html.Raw.
Example:
<a title="@Html.Raw("Show Size 6½-8")">Test1</a>
Expected:
<a title="Show Size 6½-8">Test1</a>
Actual (doubly-encoded somehow):
<a title="Show Size 6&#189;-8">Test1</a>
[Original Stack Overflow question:
http://stackoverflow.com/q/12321616/48700]