解决.NET Core MVC 视图中的中文被html编码的问题

在  .net core mvc 视图输出 变量的时候 默认使用的是 UnicodeRanges.BasicLatin  进行的编码 

所以 输出中文后在查看源码的时候是进过编码了的 。

解决方案  

  在 Startup.cs 的 ConfigureServices() 方法中添加下面的一行代码:


services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
---------------------
作者:megoodtoo
来源:CSDN
原文:https://blog.csdn.net/MeGoodtoo/article/details/73481173
 

原文地址:https://www.cnblogs.com/evemen/p/10417347.html