I have an ASP.NET MVC controller that returns a view. In this view i create some html. For example
@Html.ActionLink(HttpUtility.HtmlDecode("¿Olvidó su contraseña?"), "ForgotYourPassword", "Account", null, new { style = "color: white; text-decoration: none;"})
The thing is, that this app needs to handle some special characters for example the ñ.
The code above works fine, the html renders without problems. But the thing is that i dont understand why should i use:
HttpUtility.HtmlDecode("¿Olvidó su contraseña?")
This line will simply return "¿Ólvido su contraseña?", but if instead of using HtmlDecode i simply use:
@Html.ActionLink("¿Ólvido su contraseña?", "ForgotYourPassword", "Account", null, new { style = "color: white; text-decoration: none;"})
The browser wont be able to show the HTML properly and it will have character encoding problems.
Why can't I simply use "¿Ólvido su contraseña?" ?. After all HttpUtility.HtmlDecode("¿Olvidó su contraseña?")
returns "¿Ólvido su contraseña?"