In my case in ASP MVC it was a method in controller that was returning null
to View because of a wrong if
statement.
if (condition)
{
return null;
}
Condition fixed and I returned View, Problem fixed. There was nothing with encoding but I don't know why that was my error.
return View(result); // result is View's model