From my controller I’m assigning either an up arrow (&uarr) or down arrow (&darr) with unicode to a ViewBag, that I want to use in the view.
Of course I want the output to become an arrow, but that doesn’t work and the output becomes a string (e.g. &uarr).
controller:
...
ViewBag.Arrow = "↑";
...
view:
...
ViewBag.Arrow <br /> // <--- ↑
...
It’s better to use
@MvcHtmlString.Create(ViewBag.Arrow)than@Html.Raw(.... See my answer here for the reason why: Writing/outputting HTML strings unescaped