In our MVC3 ASP.net project, the HttpUtility.HtmlEncode method seems to avoid too many characters. Our web pages serve as UTF-8 pages, but the method avoids characters such as ü or the yen symbol ¥, even if the tez characters are part of the UTF-8 set .
So, when my asp.net MVC view contains the following code snippet:
@("<strong>ümlaut</strong>")
Then I would expect Encoder to avoid html tags, but not ümlaut
<strong>ümlaut</strong>
But instead, he gives me the following HTML snippet:
<strong>&
For completeness, I also mention that responseEncoding in web.config is explicitly set to utf-8, so I would expect the HtmlEncode method to respect this parameter.
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
Thomas
source share