Is there an easy way to specify all \"normal\" views is an ASP.NET MVC app are to have charset=utf-8
appended to the Content-Type
? View()
You could write an attribute for it:
public class CharsetAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
filterContext.HttpContext.Response.Headers["Content-Type"] += ";charset=utf-8";
}
}
Feel free to make it a bit smarter, but that's the general idea. Add it to your base controller class and your whole app is covered.