Question

I'm having prolemas with accents when they step values ​​to ViewData.

In Controller:

ViewData["mensagem"] = "Não Esta Correto"

In View:

@Html.Encode(ViewData["mensagem"])

appears the : Não Esta Correto

Only the string that is passed by the ViewData have this problem, how to fix .

Was it helpful?

Solution

@ already encodes. This is the main diff between razor and aspx ... You are double encoding.

@ViewData["mensagem"]

To NOT encode:

@Html.Raw(ViewData["mensagem"])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top