解决 .net Core  中文等非英文文字html输出编码输出问题

页面显示正常,查看源代码里面输出的中文会被编码,如下

.net Core 中文等非英文文字html输出编码输出问题

 

解决办法:在 public void ConfigureServices(IServiceCollection services) 中增加

services.Configure<WebEncoderOptions>(options =>
                options.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.BasicLatin, UnicodeRanges.CjkUnifiedIdeographs));

效果如下

.net Core 中文等非英文文字html输出编码输出问题

因为弄不明白搜索引擎的原理,不知被编码后是否影响收录,所以作此调整

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2022-01-24
  • 2022-02-10
  • 2021-08-25
  • 2022-02-10
相关资源
相似解决方案