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 .

Était-ce utile?

La 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"])
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top