Reputation: 22389
I'm parsing a Razor template that contains code such as
@model.Field
When Field
includes a
, it gets escaped and turns into  
.
How do I apply a real non-breaking space and prevent the escaping of &
?
Upvotes: 3
Views: 2956
Reputation: 18620
Use @Html.Raw(model.Field)
.
It will prevent HTML encoding of your data (which happens by default since Razor v3).
See MSDN and this Quick Reference by Phil Haack.
update
I now see you're using RazorEngine. In RazorEngine you can just use the built-in Raw method like this: @Raw(model.Field)
Upvotes: 8